supersimple

package module
v0.0.0-...-38bc8f7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2019 License: MIT Imports: 18 Imported by: 0

README

supersimple

A research and iteration repo for learning gqlgen. Implementing aggregation in MongoDB, go-redis, and APQ.

This is a non-project research repo for cementing fundamentals of Gqlgen, as well as exploring implementations of supporting technologies, such as Redis, Apollo Client, APQ, and MongoDB.

TODO:

  • Implement Book and Author models.
  • Use aggregation to join Authors and Books:
    • Books contain an array of Author IDs.
    • Authors can match their ID with Books.

Joins:

  • Authors
    • .books returns an array of Books
  • Books
    • .authors returns an array of Authors

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoMongo

func GoMongo(db string, col string) (context.Context, *mongo.Collection)
What I need:

Create - many Read - one Update - many Update - all Delete - many Delete - all

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

Types

type ComplexityRoot

type ComplexityRoot struct {
	Mutation struct {
		CreateUser func(childComplexity int, input supersimple.NewUser) int
		DeleteUser func(childComplexity int, id primitive.ObjectID) int
		UpdateUser func(childComplexity int, id primitive.ObjectID, name string) int
	}

	Query struct {
		OneUser func(childComplexity int, id *primitive.ObjectID, name *string) int
		Users   func(childComplexity int) int
	}

	User struct {
		ID   func(childComplexity int) int
		Name func(childComplexity int) int
	}
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
}

type MutationResolver

type MutationResolver interface {
	CreateUser(ctx context.Context, input supersimple.NewUser) (*supersimple.User, error)
	UpdateUser(ctx context.Context, id primitive.ObjectID, name string) (*supersimple.User, error)
	DeleteUser(ctx context.Context, id primitive.ObjectID) (*supersimple.User, error)
}

type QueryResolver

type QueryResolver interface {
	OneUser(ctx context.Context, id *primitive.ObjectID, name *string) (*supersimple.User, error)
	Users(ctx context.Context) ([]*supersimple.User, error)
}

type Resolver

type Resolver struct{}

func (*Resolver) Mutation

func (r *Resolver) Mutation() MutationResolver

func (*Resolver) Query

func (r *Resolver) Query() QueryResolver

type ResolverRoot

type ResolverRoot interface {
	Mutation() MutationResolver
	Query() QueryResolver
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL