⚡️ A Go framework for rapidly building powerful graphql services

Thunder is a Go framework for rapidly building powerful graphql servers. Thunder has support for schemas automatically generated from Go types, live queries, query batching, and more. Thunder is an open-source project from Samsara.

Documentation

Feature Lightning Tour

Thunder has a number of features to make it easy to build sophisticated schemas. This section provides a brief overview of some of them.

Reflection-based schema building

Thunder generates resolvers automatically from Go struct types and function definitions. For example, the Friend struct below gets exposed as a graphql object type with firstName and lastName resolvers that return the fields on the type.

// Friend is a small struct representing a person.
type Friend struct {
  FirstName string
  Last string `graphql:"lastName"` // use a custom name

  Added time.Date `graphql:"-"` // don't expose over graphql
}

// FullName builds a friend's full name.
func (f *Friend) FullName() string {
  return fmt.Sprintf("%s %s", f.FirstName, f.Last)
}

// registerFriend registers custom resolvers on the Friend type.
//
// Note: registerFriend wouldn't be necessary if the type only
// had the default struct field resolvers above.
func registerFriend(schema *schemabuilder.Schema) {
  object := schema.Object("Friend", Friend{})

  // fullName is a computed field on the Friend{} object.
  object.FieldFunc("fullName", Friend.FullName)
}

Pagination

Live queries

Thunder has support for automatically updating queries using resolver invalidation. With invalidation, code on the server can trigger updates on the client using a persistent WebSocket connection.

The simplest example is a clock that updates over time. Every 10 seconds the time function will be recomputed, and the latest time will be sent to the client.

// registerQuery registers the resolvers on the core graphql query type.
func registerQuery(schema *schemabuilder.Schema) {
  query := schema.Query()

  // time returns the current time.
  query.FieldFunc("time", func(ctx context.Context) string {
    // Invalidate the result of this resolver after 10 seconds.
    reactive.InvalidateAfter(ctx, 10 * time.Second)
    // Return the current time. Will be re-executed automatically.
    return time.Now().String()
  })
}

Using Thunder's lightweight sqlgen and livesql ORM, it's easy to write automatically updating MySQL queries. The example below returns a live-updating lists of posts from a database table. Whenever somebody INSERTs or UPDATEs a row in the table, the resolver is re-executed and the latest lists of posts is sent to the client. Behind the scenes, the livesql package uses MySQL's binary replication log to detect changes to the underlying data.

// A Post holds a row from the MySQL posts table.
type Post struct {
  Id    int64 `sqlgen:",primary"`
  Title string
}

// Server implements a graphql server. It has persistent handles to eg. the
// database.
type Server struct {
  db *livesql.LiveDB
}

// registerQuery registers the root query resolvers.
func (s *Server) registerQuery(schema *schemabuilder.Schema) {
  query := schema.Query()
  // posts returns all posts in the database.
  query.FieldFunc("posts", func(ctx context.Context) ([]*Post, error) {
    var posts []*Post
    if err := s.db.Query(ctx, &posts, nil, nil); err != nil {
      return nil, err
    }
    return posts, nil
  })
}

Built-in parallel execution and batching

Thunder automatically runs independent resolvers in different goroutines to quickly compute complex queries. To keep large queries efficient, Thunder has support for built-in batching similar to Facebook's dataloader. With batching, Thunder automatically combines many parallel individual calls to a batch.Func's Invoke function into a single call to Many function.

Batching is very useful when fetching related objects from a SQL database. Thunder's sqlgen and livesql have built-in support for batching and will combine SELECT WHERE statements using an IN clause. For example, the program below will fetch all posts and their authors in just two queries.

type Post struct {
  Id    int64 `sqlgen:",primary"`
  Title string
  AuthorId int64
}

// An Author represents a row in the authors table.
type Author struct {
  Id   int64 `sqlgen:",primary"`
  Name string
}

// registerPost registers resolvers on the Post type.
func (s *Server) registerPost(schema *schemabuilder.Schema) {
  object := schema.Object("post", Post{})
  // author return the Author object corresponding to a Post's AuthorId.
  object.FieldFunc("author", func(ctx context.Context, p *Post) (*Author, error) {
    var author *Author
    if err := s.db.QueryRow(ctx, &author, sqlgen.Filter{"id": p.AuthorId}, nil); err != nil {
      return nil, err
    }
    return author, nil
  })
}

To execute the query

query PostsWithAuthors {
  posts {
    title
    author { name }
  }
}

Thunder will execute SELECT * FROM posts and, if that returns three posts with author IDs 10, 20, and 31, a follow-up query SELECT * FROM authors WHERE id IN (10, 20, 31).

Built-in graphiql

To get started quickly without wrangling any JavaScript, Thunder comes with a built-in graphiql client as an HTTP handler. To use it, simply expose with Go's built-in HTTP server.

// Expose schema and graphiql.
http.Handle("/graphql", graphql.Handler(schema))
http.Handle("/graphiql/", http.StripPrefix("/graphiql/", graphiql.Handler()))
http.ListenAndServe(":3030", nil)

Split schema building for large graphql servers

A large GraphQL server might have many resolvers on some shared types. To keep packages reasonably-sized, Thunder's schema builder supports extending a schema. For example, if you have a User type with a resolver photos implemented by your photos package, and resolver events implemented by your calendar package, those packages can independently register their resolvers:

package common

type User struct {}


package photos

type PhotosServer {}

func (s *PhotosServer) registerUser(schema *schemabuilder.Schema) {
  object := schema.Object("User", common.User{})
  object.FieldFunc("photos", s.fetchUserPhotos)
}


package events

type EventsServer {}

func (s *EventsServer) registerUser(schema *schemabuilder.Schema) {
  object := schema.Object("User", common.User{})
  object.FieldFunc("events", s.fetchUserEvents)
}

Getting started

First, a fair warning. The Thunder library is still a little bit tricky to use outside of Samsara. The examples above and below work, but eg. the npm client still requires some wrangling.

A minimal complete server

The program below is a fully-functional graphql server written using Thunder. It does not use sqlgen, livesql, or batching, but does include a live-updating resolver.

package main

import (
  "context"
  "net/http"
  "time"

  "github.com/samsarahq/thunder/graphql"
  "github.com/samsarahq/thunder/graphql/graphiql"
  "github.com/samsarahq/thunder/graphql/introspection"
  "github.com/samsarahq/thunder/graphql/schemabuilder"
  "github.com/samsarahq/thunder/reactive"
)

type post struct {
  Title     string
  Body      string
  CreatedAt time.Time
}

// server is our graphql server.
type server struct {
  posts []post
}

// registerQuery registers the root query type.
func (s *server) registerQuery(schema *schemabuilder.Schema) {
  obj := schema.Query()

  obj.FieldFunc("posts", func() []post {
    return s.posts
  })
}

// registerMutation registers the root mutation type.
func (s *server) registerMutation(schema *schemabuilder.Schema) {
  obj := schema.Mutation()
  obj.FieldFunc("echo", func(args struct{ Message string }) string {
    return args.Message
  })
}

// registerPost registers the post type.
func (s *server) registerPost(schema *schemabuilder.Schema) {
  obj := schema.Object("Post", post{})
  obj.FieldFunc("age", func(ctx context.Context, p *post) string {
    reactive.InvalidateAfter(ctx, 5*time.Second)
    return time.Since(p.CreatedAt).String()
  })
}

// schema builds the graphql schema.
func (s *server) schema() *graphql.Schema {
  builder := schemabuilder.NewSchema()
  s.registerQuery(builder)
  s.registerMutation(builder)
  s.registerPost(builder)
  return builder.MustBuild()
}

func main() {
  // Instantiate a server, build a server, and serve the schema on port 3030.
  server := &server{
    posts: []post{
      {Title: "first post!", Body: "I was here first!", CreatedAt: time.Now()},
      {Title: "graphql", Body: "did you hear about Thunder?", CreatedAt: time.Now()},
    },
  }

  schema := server.schema()
  introspection.AddIntrospectionToSchema(schema)

  // Expose schema and graphiql.
  http.Handle("/graphql", graphql.Handler(schema))
  http.Handle("/graphiql/", http.StripPrefix("/graphiql/", graphiql.Handler()))
  http.ListenAndServe(":3030", nil)
}

Using Thunder without Websockets (POST requests)

For use with non-live clients (e.g. Relay, Apollo) thunder provides an HTTP handler that can serve POST requests, instead of having the client connect over a websocket. In this mode, thunder does not provide live query updates.

In the above example, the main function would be changed to look like:

func main() {
  // Instantiate a server, build a server, and serve the schema on port 3030.
  server := &server{
    posts: []post{
      {Title: "first post!", Body: "I was here first!", CreatedAt: time.Now()},
      {Title: "graphql", Body: "did you hear about Thunder?", CreatedAt: time.Now()},
    },
  }

  schema := server.schema()
  introspection.AddIntrospectionToSchema(schema)

  // Expose GraphQL POST endpoint.
  http.Handle("/graphql", graphql.HTTPHandler(schema))
  http.ListenAndServe(":3030", nil)
}

Emitting a schema.json

Thunder can emit a GraphQL introspection query schema useful for compatibility with other GraphQL tooling. Alongside code from the above example, here is a small program for registering our schema and writing the JSON output to stdout.

// schema_generator.go

func main() {
  // Instantiate a server and run the introspection query on it.
  server := &server{...}

  builderSchema := schemabuilder.NewSchema()
  server.registerQuery(builderSchema)
  server.registerMutation(builderSchema)
  // ...

  valueJSON, err := introspection.ComputeSchemaJSON(*builderSchema)
  if err != nil {
    panic(err)
  }

  fmt.Print(string(valueJSON))
}

This program can then be run to generate schema.json:

$ go run schema_generator.go > schema.json

Code organization

The source code in this repository is organized as follows:

  • The example/ directory contains a basic Thunder application.
  • The graphql/ directory contains Thunder's graphql parser and executor.
  • The reactive/ directory contains Thunder's core dependency-tracking and live-update mechanism.
  • The batch/ directory contains Thunder's batching package.
  • The diff/ and merge/ directories contain Thunder's JSON diffing library used for live queries.
  • The livesql/ directory contains a Thunder driver for MySQL.
  • The sqlgen/ directory contains a lightweight SQL query generator used by livesql/.

Status

Thunder has proven itself in production use at Samsara for close to two years. This repository is still under development, and there will be some breaking changes to the API but they should be manageable. If you're adventurous, please give it a try.

Comments
  • Support User Defined Scalars

    Support User Defined Scalars

    Hi,

    Thank you for this library, I particularly like Thunder's style and performance over other implementations, not to mention its name ⚡️.

    I've tried to add a function which adds support for user defined types. This will help support types like ID. I can also add an example for this in a separate PR, if this gets accepted along with some tests.

    If this is part of your roadmap please review the PR or else I'll maintain a fork.

    This is related to #163 and #162.

    Thank You.

  • go sqlgen: Add SELECT ... FOR UPDATE support

    go sqlgen: Add SELECT ... FOR UPDATE support

    Added a ForUpdate option to the SelectOptions, in order to lock rows in a transaction using the SELECT ... FOR UPDATE syntax. The mysql documentation for locking reads can be found here.

  • Prototype: Federation API changes

    Prototype: Federation API changes

    When created a federated field func we use to have to do

    schema.Federation().FederatedFieldFunc("Device", func(args struct{ Keys []SafetyDevice }) []*SafetyDevice {
            return args.Keys 
    })
    

    but since this is always on a federated object we can simplify the api

    s2.FederatedFieldFunc("Device", func(args struct{ Keys []SafetyDevice }) []*SafetyDevice {
            return args.Keys 
    })
    

    Also fixed any linting issues in the files changed.

  • Schema Syncer

    Schema Syncer

    We want to create a schemasyncer in the gateway that listens for changes to the seperate gqlservers. It then can then update its planner to know about the changes whenever any of the gqlservers change without restarting

  • go graphql: Add ConcurrencyController option for batch and non-expensive execution

    go graphql: Add ConcurrencyController option for batch and non-expensive execution

    Summary: Adds the ability to control the number of concurrent work units we'll create for batch and non-expensive fields. This allows us to control how big batches get and allows us the ability to split these batches into smaller sub-executions (sometimes we get diminishing returns from batches after they get to a certain size).

  • go graphql: Add BatchFieldFuncs to new Executor

    go graphql: Add BatchFieldFuncs to new Executor

    Summary: Adds support for running fieldFuncs as a "Batch" instead of one at a time. The API surface of this forces passing in a Fallback/Non-batch function that has the same signature as the batch function. This is mostly for the transition period, eventually we'll go full-batch.

  • go sqlgen: Add support for converting

    go sqlgen: Add support for converting "Zero" value fields to NULL in the db

    Summary: Adds support to sqlgen to convert "Zero" value model fields to NULL in the database. This only needs to be applied when inserting a value to the database because when we read from the db NULL values are noop (leaving the zero value).

    I put some cleanups in the PR as well, would be easy to pull them out if we want.

    Additionally, I wrote tests for the "Main" use cases, but I'm very open to add tests for other edge cases, let me know and I'll add them.

  • serialize dependencies into protobuf

    serialize dependencies into protobuf

    We'd like to ship dependencies out of thunder server process, which allows us to restore a subscription and avoid expensive initial computation when a client reconnects and resumes prior subscriptions. This also enables external dependency invalidator that can make thunder server stateless.

  • [Major Change] Introduce `types` package for type handling in sqlgen

    [Major Change] Introduce `types` package for type handling in sqlgen

    Goals

    1. Support protobuf struct (de)serialization
    2. Support custom scalars. For real. Like, types that aren't natively supported by SQL.
    3. Keep supporting scalar aliases (string -> custom string etc).

    Changes

    This PR adds a types package with the intention of replacing Scannables / TypeConverters. This unifies all of our logic in one place for determining how values are converted, while also supporting native interfaces.

    Implementation

    1. Replace scannables with fields. Ensure that Empty/Interface is being called when scanning values.
    2. Add integration tests for both native and custom types.
    3. Deprecate MustRegisterCustomScalar and MustRegisterSimpleScalar.
    4. ???
    5. Profit

    Usage

    type Model struct {
      Foo ProtoModel `sql:",binary"` // (de)serializes to a binary blob via `Marshal`/`MarshalBinary`
      IP IP `sql:",primary,string"` // (de)serializes into a string via `MarshalText`
      UUID UUID // serializes via `sql/driver.Valuer` and deserializes via `sql.Scanner`
      Bar CustomString // (de)serializes the same way a native string would
      // int8, int16, int32 are converted to int64
      // uint8, uint16, uint32, uint64 are converted to int64
      // float32 is converted to float64
      // bool, float64, int64, string, []byte, time.Time and nil are natively supported
    }
    

    (but really, after this is implemented for SQL, look at where we could use it on the GraphQL side as well)

  • test with go1.15, use go modules

    test with go1.15, use go modules

    Some issue creators noted that we only test thunder in go 1.10. Since we use go 1.15 in production, this seems unwise. This commit sets the go version to 1.15. It also makes a change to use go modules rather than the vendor folder. I don't think we can make one change without the other, but I know very little about go modules and I'd love to be mistaken.

    XXX: I know our setup is a bit weird, and I'm a bit concerned that we'll have to make changes to internal repos next time we revendor thunder. Maybe we can add it as a module? That would be neat. I'm inclined to merge this change, then figure that out.


    commands:

    go mod init     // This signaled an error wrt. an "appengine" thing in vendor.json
                    // I made the changes below to vendor.json, then tried again.
    go mod vendor
    rm -rf vendor
    

    vendor.json:

    "ignore": "appengine appenginevm test",         // I removed appengine and appenginevm.
    "package": [
    	{                                       // I removed this whole package entry.
    		"path": "appengine/cloudsql",
    		"revision": ""
    	},
    

    There are also two commits that fix small build/test errors present when running with go1.15.

  • Numeric Rounding

    Numeric Rounding

    JavaScript treats all numeric values as double-precision floating points. This may cause unintended rounding on large integer values. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER

    A common way to bypass this issue is to encode to strings. The core library supports this solution with the json:",string" tag. Thunder ignores JSON tags (issue #217) unfortunately.

  • Weilian/federation introspection client

    Weilian/federation introspection client

    This PR adds an introspection client to the federation executor. This introspection client runs at the gateway executor and will serve all introspection queries.

    After collecting all the schemas, the SchemaSyncer will combine all federated schemas, and run an introspection query on it, populating the result to the introspection client. This allows an introspection query to be served as if only one graphql schema is running.

  • build(deps): bump qs from 6.4.0 to 6.4.1 in /client

    build(deps): bump qs from 6.4.0 to 6.4.1 in /client

    Bumps qs from 6.4.0 to 6.4.1.

    Changelog

    Sourced from qs's changelog.

    6.4.1

    • [Fix] parse: ignore __proto__ keys (#428)
    • [Fix] fix for an impossible situation: when the formatter is called with a non-string value
    • [Fix] use safer-buffer instead of Buffer constructor
    • [Fix] utils.merge: avoid a crash with a null target and an array source
    • [Fix] utils.merge: avoid a crash with a null target and a truthy non-array source
    • [Fix] stringify: fix a crash with strictNullHandling and a custom filter/serializeDate (#279)
    • [Fix] utils: merge: fix crash when source is a truthy primitive & no options are provided
    • [Fix] when parseArrays is false, properly handle keys ending in []
    • [Robustness] stringify: avoid relying on a global undefined (#427)
    • [Refactor] use cached Array.isArray
    • [Refactor] stringify: Avoid arr = arr.concat(...), push to the existing instance (#269)
    • [readme] remove travis badge; add github actions/codecov badges; update URLs
    • [Docs] Clarify the need for "arrayLimit" option
    • [meta] fix README.md (#399)
    • [meta] Clean up license text so it’s properly detected as BSD-3-Clause
    • [meta] add FUNDING.yml
    • [actions] backport actions from main
    • [Tests] remove nonexistent tape option
    • [Dev Deps] backport from main
    Commits
    • 486aa46 v6.4.1
    • 727ef5d [Fix] parse: ignore __proto__ keys (#428)
    • cd1874e [Robustness] stringify: avoid relying on a global undefined (#427)
    • 45e987c [readme] remove travis badge; add github actions/codecov badges; update URLs
    • 90a3bce [meta] fix README.md (#399)
    • 9566d25 [Fix] fix for an impossible situation: when the formatter is called with a no...
    • 74227ef Clean up license text so it’s properly detected as BSD-3-Clause
    • 35dfb22 [actions] backport actions from main
    • 7d4670f [Dev Deps] backport from main
    • 0485440 [Fix] use safer-buffer instead of Buffer constructor
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

  • build(deps): bump express from 4.14.0 to 4.18.2 in /example/client

    build(deps): bump express from 4.14.0 to 4.18.2 in /example/client

    Bumps express from 4.14.0 to 4.18.2.

    Release notes

    Sourced from express's releases.

    4.18.2

    4.18.1

    • Fix hanging on large stack of sync routes

    4.18.0

    ... (truncated)

    Changelog

    Sourced from express's changelog.

    4.18.2 / 2022-10-08

    4.18.1 / 2022-04-29

    • Fix hanging on large stack of sync routes

    4.18.0 / 2022-04-25

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

  • build(deps): bump qs from 6.4.0 to 6.4.1 in /graphql/graphiql

    build(deps): bump qs from 6.4.0 to 6.4.1 in /graphql/graphiql

    Bumps qs from 6.4.0 to 6.4.1.

    Changelog

    Sourced from qs's changelog.

    6.4.1

    • [Fix] parse: ignore __proto__ keys (#428)
    • [Fix] fix for an impossible situation: when the formatter is called with a non-string value
    • [Fix] use safer-buffer instead of Buffer constructor
    • [Fix] utils.merge: avoid a crash with a null target and an array source
    • [Fix] utils.merge`: avoid a crash with a null target and a truthy non-array source
    • [Fix] stringify: fix a crash with strictNullHandling and a custom filter/serializeDate (#279)
    • [Fix] utils: merge: fix crash when source is a truthy primitive & no options are provided
    • [Fix] when parseArrays is false, properly handle keys ending in []
    • [Robustness] stringify: avoid relying on a global undefined (#427)
    • [Refactor] use cached Array.isArray
    • [Refactor] stringify: Avoid arr = arr.concat(...), push to the existing instance (#269)
    • [readme] remove travis badge; add github actions/codecov badges; update URLs
    • [Docs] Clarify the need for "arrayLimit" option
    • [meta] fix README.md (#399)
    • [meta] Clean up license text so it’s properly detected as BSD-3-Clause
    • [meta] add FUNDING.yml
    • [actions] backport actions from main
    • [Tests] remove nonexistent tape option
    • [Dev Deps] backport from main
    Commits
    • 486aa46 v6.4.1
    • 727ef5d [Fix] parse: ignore __proto__ keys (#428)
    • cd1874e [Robustness] stringify: avoid relying on a global undefined (#427)
    • 45e987c [readme] remove travis badge; add github actions/codecov badges; update URLs
    • 90a3bce [meta] fix README.md (#399)
    • 9566d25 [Fix] fix for an impossible situation: when the formatter is called with a no...
    • 74227ef Clean up license text so it’s properly detected as BSD-3-Clause
    • 35dfb22 [actions] backport actions from main
    • 7d4670f [Dev Deps] backport from main
    • 0485440 [Fix] use safer-buffer instead of Buffer constructor
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

  • build(deps): bump decode-uri-component from 0.2.0 to 0.2.2 in /client

    build(deps): bump decode-uri-component from 0.2.0 to 0.2.2 in /client

    Bumps decode-uri-component from 0.2.0 to 0.2.2.

    Release notes

    Sourced from decode-uri-component's releases.

    v0.2.2

    • Prevent overwriting previously decoded tokens 980e0bf

    https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.1...v0.2.2

    v0.2.1

    • Switch to GitHub workflows 76abc93
    • Fix issue where decode throws - fixes #6 746ca5d
    • Update license (#1) 486d7e2
    • Tidelift tasks a650457
    • Meta tweaks 66e1c28

    https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.1

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

  • Pass args to sort and filter methods

    Pass args to sort and filter methods

    Allow users to provide filter and sort fields that implement the connection arguments of the FieldFunc.

    This allows for pre-filtering on sort fields in the event that a sort field has to be filtered before providing sort values. It also provides more flexibility in the filter fields and what type of action they can take if the arguments are passed directly to them.

    Passing the ConnectionArgs.Args as userArgs to the GraphQL resolvers through the applySort and applyTextFilterField methods exposing the userArgs down to the subsequent schemabuilder methods (FilterField, BatchFilterField, SortField, BatchSortField)

    This allows us to take action on these userArgs at the filter/sort level such as within a sort method, filtering on some userArgs before actually populating sort values. For example, filtering on start/end time within a sort method so that sorted values are based on a higher order filter.

    For example:

    type UserArgs struct {
      StartTime *int64
      EndTime *int64
    }
    
    type Item struct {
      Id         int64
      Number     int64
      String     string
      Float      float64
    }
    
    inner := schema.Object("inner", Inner{})
    inner.FieldFunc("innerConnectionWithPassedArgs", func(args Args) []Item {
        return []Item{
          {Id: 1, Number: 1, String: "1", Float: 1.0},
          {Id: 2, Number: 3, String: "3", Float: 3.0},
          {Id: 3, Number: 5, String: "5", Float: 5.0},
        }
      },
      schemabuilder.Paginated,
      schemabuilder.BatchSortField(
        "batchSortWithArgs",
        func(ctx context.Context, items map[batch.Index]Item, args Args) (map[batch.Index]int64, error) {
          // Batch sort using args
        }),
      schemabuilder.BatchFilterField(
        "batchFilterWithArgs",
        func(items map[batch.Index]Item, args Args) (map[batch.Index]string, error) {
          // Batch filter using args
        }),
    )
    
A collection of Go packages for creating robust GraphQL APIs

api-fu api-fu (noun) (informal) Mastery of APIs. ?? Packages The top level apifu package is an opinionated library that aims to make it as easy as pos

Dec 28, 2022
graphql parser + utilities

graphql utilities for dealing with GraphQL queries in Go. This package focuses on actually creating GraphQL servers and expects you to describe your s

Dec 20, 2022
GraphQL server with a focus on ease of use
GraphQL server with a focus on ease of use

graphql-go The goal of this project is to provide full support of the GraphQL draft specification with a set of idiomatic, easy to use Go packages. Wh

Dec 31, 2022
An implementation of GraphQL for Go / Golang

graphql An implementation of GraphQL in Go. Follows the official reference implementation graphql-js. Supports: queries, mutations & subscriptions. Do

Dec 26, 2022
Convert Golang Struct To GraphQL Object On The Fly

Straf Convert Golang Struct To GraphQL Object On The Fly Easily Create GraphQL Schemas Example Converting struct to GraphQL Object type UserExtra stru

Oct 26, 2022
GraphQL server with a focus on ease of use
GraphQL server with a focus on ease of use

graphql-go The goal of this project is to provide full support of the GraphQL draft specification with a set of idiomatic, easy to use Go packages. Wh

Dec 25, 2022
GQLEngine is the best productive solution for implementing a GraphQL server 🚀

GQLEngine is the best productive solution for implementing a graphql server for highest formance examples starwars: https://github.com/gqlengine/starw

Apr 24, 2022
go generate based graphql server library
go generate based graphql server library

gqlgen What is gqlgen? gqlgen is a Go library for building GraphQL servers without any fuss. gqlgen is based on a Schema first approach — You get to D

Dec 31, 2022
gqlanalysis makes easy to develop static analysis tools for GraphQL in Go.
gqlanalysis makes easy to develop static analysis tools for GraphQL in Go.

gqlanalysis gqlanalysis defines the interface between a modular static analysis for GraphQL in Go. gqlanalysis is inspired by go/analysis. gqlanalysis

Dec 14, 2022
Tools to write high performance GraphQL applications using Go/Golang.

graphql-go-tools Sponsors WunderGraph Are you looking for a GraphQL e2e data fetching solution? Supports frameworks like NextJS, type safety with gene

Dec 27, 2022
Go monolith with embedded microservices including GRPC,REST,GraphQL and The Clean Architecture.
Go monolith with embedded microservices including GRPC,REST,GraphQL and The Clean Architecture.

GoArcc - Go monolith with embedded microservices including GRPC,REST, graphQL and The Clean Architecture. Description When you start writing a Go proj

Dec 21, 2022
GraphQL implementation for click house in Go.
GraphQL implementation for click house in Go.

clickhouse-graphql-go GraphQL implementation for clickhouse in Go. This package stores real time streaming websocket data in clickhouse and uses Graph

Nov 20, 2022
GraphQL parser comparison in different languages

graphql-parser-bench Parsing a schema or document can be a critical part of the application, especially if you have to care about latency. This is the

Jul 10, 2022
A simple Go, GraphQL, and PostgreSQL starter template

Simple Go/GraphQL/PostgreSQL template Purpose Have a good starting point for any project that needs a graphql, go, and postgres backend. It's a very l

Jan 8, 2022
A GraphQL complete example using Golang And PostgreSQL

GraphQL with Golang A GraphQL complete example using Golang & PostgreSQL Installation Install the dependencies go get github.com/graphql-go/graphql go

Dec 6, 2022
This app is an attempt towards using go lang with graphql data fetch in react front end.

go_movies _A React js + GraphQL supported with backend in GoLang. This app is an attempt towards using go lang with graphql data fetch in react front

Dec 7, 2021
proof-of-concept minimal GraphQL service for LTV

LTV GraphQL Proof-of-Concept This is a barebones proof-of-concept of a possible GraphQL implementation that interacts with Core. It includes a few ver

Jan 4, 2022
Learn GraphQL with THE [email protected] SHINY COLORS.

faaaar Learn GraphQL with THE [email protected] SHINY COLORS. Getting Started The following is a simple example which get information about 20-year-old idols

Dec 11, 2022
A simple (yet effective) GraphQL to HTTP / REST router

ReGraphQL A simple (yet effective) GraphQL to REST / HTTP router. ReGraphQL helps you expose your GraphQL queries / mutations as REST / HTTP endpoints

Dec 12, 2022