gqlgen

package
v0.0.0-...-a8786dc Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

func NewHandler

func NewHandler(repo pg.Repository, app app.App, auth auth.AuthService) http.Handler

NewHandler returns a new graphql endpoint handler.

func NewPlaygroundHandler

func NewPlaygroundHandler(endpoint string) http.Handler

NewPlaygroundHandler returns a new GraphQL Playground handler.

Types

type ComplexityRoot

type ComplexityRoot struct {
	Item struct {
		ID     func(childComplexity int) int
		Name   func(childComplexity int) int
		Source func(childComplexity int) int
	}

	List struct {
		Hearts func(childComplexity int) int
		ID     func(childComplexity int) int
		Items  func(childComplexity int) int
		Name   func(childComplexity int) int
		User   func(childComplexity int) int
	}

	ListHeart struct {
		ID   func(childComplexity int) int
		List func(childComplexity int) int
		User func(childComplexity int) int
	}

	ListHeartAggregate struct {
		ByCurrentUser func(childComplexity int) int
		Count         func(childComplexity int) int
		Hearts        func(childComplexity int) int
	}

	ListItem struct {
		Collected func(childComplexity int) int
		ID        func(childComplexity int) int
		Item      func(childComplexity int) int
		Quantity  func(childComplexity int) int
	}

	LogoutOutput struct {
		Succeeded func(childComplexity int) int
		UserID    func(childComplexity int) int
	}

	Mutation struct {
		CreateList     func(childComplexity int, data ListInput) int
		CreateListItem func(childComplexity int, listItemData CreateListItemInput) int
		DeleteItem     func(childComplexity int, id int64) int
		DeleteList     func(childComplexity int, id int64) int
		DeleteUser     func(childComplexity int, id int64) int
		Heart          func(childComplexity int, listID int64) int
		Login          func(childComplexity int, data LoginInput) int
		Logout         func(childComplexity int) int
		Refresh        func(childComplexity int) int
		Register       func(childComplexity int, data UserInput) int
		SetListItem    func(childComplexity int, data ListItemInput) int
		UnsetListItem  func(childComplexity int, id int64) int
		UpdateItem     func(childComplexity int, id int64, data ItemInput) int
		UpdateList     func(childComplexity int, id int64, data ListInput) int
		UpdateListItem func(childComplexity int, id int64, data ListItemInput) int
		UpdateUser     func(childComplexity int, id int64, data UserInput) int
	}

	Query struct {
		Item  func(childComplexity int, id int64) int
		Items func(childComplexity int) int
		List  func(childComplexity int, id int64) int
		Lists func(childComplexity int) int
		Me    func(childComplexity int) int
		User  func(childComplexity int, id int64) int
		Users func(childComplexity int) int
	}

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

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type CreateListItemInput

type CreateListItemInput struct {
	Name      string `json:"name"`
	Source    string `json:"source"`
	Quantity  *int   `json:"quantity"`
	Collected bool   `json:"collected"`
	ListID    int64  `json:"list_id"`
}

type DirectiveRoot

type DirectiveRoot struct {
}

type ItemInput

type ItemInput struct {
	Name   string `json:"name"`
	Source string `json:"source"`
}

type ListHeartAggregate

type ListHeartAggregate struct {
	Count         int            `json:"count"`
	ByCurrentUser bool           `json:"byCurrentUser"`
	Hearts        []pg.ListHeart `json:"hearts"`
}

type ListHeartResolver

type ListHeartResolver interface {
	User(ctx context.Context, obj *pg.ListHeart) (*pg.User, error)
	List(ctx context.Context, obj *pg.ListHeart) (*pg.List, error)
}

type ListInput

type ListInput struct {
	Name string `json:"name"`
}

type ListItemInput

type ListItemInput struct {
	Quantity  *int  `json:"quantity"`
	Collected bool  `json:"collected"`
	ListID    int64 `json:"list_id"`
	ItemID    int64 `json:"item_id"`
}

type ListItemResolver

type ListItemResolver interface {
	Quantity(ctx context.Context, obj *pg.ListItem) (*int, error)

	Item(ctx context.Context, obj *pg.ListItem) (*pg.Item, error)
}

type ListResolver

type ListResolver interface {
	User(ctx context.Context, obj *pg.List) (*pg.User, error)
	Items(ctx context.Context, obj *pg.List) ([]pg.ListItem, error)
	Hearts(ctx context.Context, obj *pg.List) (*ListHeartAggregate, error)
}

type LoginInput

type LoginInput struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type LogoutOutput

type LogoutOutput struct {
	UserID    int64 `json:"user_id"`
	Succeeded bool  `json:"succeeded"`
}

type MutationResolver

type MutationResolver interface {
	Login(ctx context.Context, data LoginInput) (*pg.User, error)
	Register(ctx context.Context, data UserInput) (*pg.User, error)
	Refresh(ctx context.Context) (*pg.User, error)
	Logout(ctx context.Context) (*LogoutOutput, error)
	UpdateUser(ctx context.Context, id int64, data UserInput) (*pg.User, error)
	DeleteUser(ctx context.Context, id int64) (*pg.User, error)
	CreateList(ctx context.Context, data ListInput) (*pg.List, error)
	UpdateList(ctx context.Context, id int64, data ListInput) (*pg.List, error)
	DeleteList(ctx context.Context, id int64) (*pg.List, error)
	CreateListItem(ctx context.Context, listItemData CreateListItemInput) (*pg.Item, error)
	UpdateItem(ctx context.Context, id int64, data ItemInput) (*pg.Item, error)
	DeleteItem(ctx context.Context, id int64) (*pg.Item, error)
	SetListItem(ctx context.Context, data ListItemInput) (*pg.ListItem, error)
	UpdateListItem(ctx context.Context, id int64, data ListItemInput) (*pg.ListItem, error)
	UnsetListItem(ctx context.Context, id int64) (*pg.ListItem, error)
	Heart(ctx context.Context, listID int64) (*pg.List, error)
}

type QueryResolver

type QueryResolver interface {
	Me(ctx context.Context) (*pg.User, error)
	User(ctx context.Context, id int64) (*pg.User, error)
	Users(ctx context.Context) ([]pg.User, error)
	List(ctx context.Context, id int64) (*pg.List, error)
	Lists(ctx context.Context) ([]pg.List, error)
	Item(ctx context.Context, id int64) (*pg.Item, error)
	Items(ctx context.Context) ([]pg.Item, error)
}

type Resolver

type Resolver struct {
	Repository pg.Repository
	App        app.App
	Auth       auth.AuthService
}

func (*Resolver) List

func (r *Resolver) List() ListResolver

List returns ListResolver implementation.

func (*Resolver) ListHeart

func (r *Resolver) ListHeart() ListHeartResolver

func (*Resolver) ListItem

func (r *Resolver) ListItem() ListItemResolver

ListItem returns ListItemResolver implementation.

func (*Resolver) Mutation

func (r *Resolver) Mutation() MutationResolver

Mutation returns MutationResolver implementation.

func (*Resolver) Query

func (r *Resolver) Query() QueryResolver

Query returns QueryResolver implementation.

func (*Resolver) User

func (r *Resolver) User() UserResolver

User returns UserResolver implementation.

type ResolverRoot

type ResolverRoot interface {
	List() ListResolver
	ListHeart() ListHeartResolver
	ListItem() ListItemResolver
	Mutation() MutationResolver
	Query() QueryResolver
	User() UserResolver
}

type UserInput

type UserInput struct {
	Name     string `json:"name"`
	Email    string `json:"email"`
	Password string `json:"password"`
}

type UserResolver

type UserResolver interface {
	Lists(ctx context.Context, obj *pg.User) ([]pg.List, error)
}

Jump to

Keyboard shortcuts

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