Documentation
¶
Overview ¶
Package graphapi does graph stuff
Index ¶
- Constants
- func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
- func WithTransactions(h *handler.Server, c *ent.Client)
- type ComplexityRoot
- type Config
- type DirectiveRoot
- type Handler
- type MutationResolver
- type QueryResolver
- type Resolver
- type ResolverRoot
- type TodoCreatePayload
- type TodoDeletePayload
- type TodoUpdatePayload
Constants ¶
View Source
const ( ActionGet = "get" ActionUpdate = "update" ActionDelete = "delete" ActionCreate = "create" )
Variables ¶
This section is empty.
Functions ¶
func NewExecutableSchema ¶
func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.
Types ¶
type ComplexityRoot ¶
type ComplexityRoot struct {
Mutation struct {
CreateTodo func(childComplexity int, input generated.CreateTodoInput) int
DeleteTodo func(childComplexity int, id string) int
UpdateTodo func(childComplexity int, id string, input generated.UpdateTodoInput) int
}
PageInfo struct {
EndCursor func(childComplexity int) int
HasNextPage func(childComplexity int) int
HasPreviousPage func(childComplexity int) int
StartCursor func(childComplexity int) int
}
Query struct {
Node func(childComplexity int, id string) int
Nodes func(childComplexity int, ids []string) int
Todo func(childComplexity int, id string) int
}
Todo struct {
Description func(childComplexity int) int
ID func(childComplexity int) int
Name func(childComplexity int) int
}
TodoCreatePayload struct {
Todo func(childComplexity int) int
}
TodoDeletePayload struct {
DeletedID func(childComplexity int) int
}
TodoUpdatePayload struct {
Todo func(childComplexity int) int
}
}
type Config ¶
type Config struct {
Schema *ast.Schema
Resolvers ResolverRoot
Directives DirectiveRoot
Complexity ComplexityRoot
}
type DirectiveRoot ¶
type DirectiveRoot struct {
}
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is an http handler wrapping a Resolver
func (*Handler) Handler ¶
func (h *Handler) Handler() http.HandlerFunc
Handler returns the http.HandlerFunc for the GraphAPI
type MutationResolver ¶
type MutationResolver interface {
CreateTodo(ctx context.Context, input generated.CreateTodoInput) (*TodoCreatePayload, error)
UpdateTodo(ctx context.Context, id string, input generated.UpdateTodoInput) (*TodoUpdatePayload, error)
DeleteTodo(ctx context.Context, id string) (*TodoDeletePayload, error)
}
type QueryResolver ¶
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver provides a graph response resolver
func NewResolver ¶
NewResolver returns a resolver configured with the given ent client
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) WithLogger ¶
func (r Resolver) WithLogger(l *zap.SugaredLogger) *Resolver
type ResolverRoot ¶
type ResolverRoot interface {
Mutation() MutationResolver
Query() QueryResolver
}
type TodoCreatePayload ¶
Return response for createTodo mutation
type TodoDeletePayload ¶
type TodoDeletePayload struct {
// Deleted todo ID
DeletedID string `json:"deletedID"`
}
Return response for deleteTodo mutation
type TodoUpdatePayload ¶
Return response for updateTodo mutation
Click to show internal directories.
Click to hide internal directories.