Documentation ¶
Index ¶
- Variables
- func LogDirective(ctx context.Context, obj any, next graphql.Resolver, message *string) (res any, err error)
- func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
- type Admin
- type ComplexityRoot
- type Config
- type CreateUserInput
- type DirectiveRoot
- type Entity
- type Mutation
- type MutationResolver
- type MutationResponse
- type Query
- type QueryResolver
- type Resolver
- type ResolverRoot
- type Role
- type Stub
- type Subscription
- type SubscriptionResolver
- type User
- type UserFilter
Constants ¶
This section is empty.
Variables ¶
View Source
var AllRole = []Role{ RoleAdmin, RoleUser, RoleGuest, }
Functions ¶
func LogDirective ¶
func LogDirective(ctx context.Context, obj any, next graphql.Resolver, message *string) (res any, err error)
LogDirective implementation
func NewExecutableSchema ¶
func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.
Types ¶
type Admin ¶
type Admin struct { ID string `json:"id"` Name string `json:"name"` Permissions []string `json:"permissions"` CreatedAt *string `json:"createdAt,omitempty"` }
func (Admin) GetCreatedAt ¶
type ComplexityRoot ¶
type ComplexityRoot struct { Admin struct { CreatedAt func(childComplexity int) int ID func(childComplexity int) int Name func(childComplexity int) int Permissions func(childComplexity int) int } Mutation struct { CreateUser func(childComplexity int, input CreateUserInput) int DeleteUser func(childComplexity int, id string) int } MutationResponse struct { Message func(childComplexity int) int Success func(childComplexity int) int } Query struct { GetEntity func(childComplexity int, id string) int GetUser func(childComplexity int, id string) int ListUsers func(childComplexity int, filter *UserFilter) int } Subscription struct { UserCreated func(childComplexity int) int } User struct { Age func(childComplexity int) int CreatedAt func(childComplexity int) int Email func(childComplexity int) int ID func(childComplexity int) int Name func(childComplexity int) int Role func(childComplexity int) int } }
type Config ¶
type Config struct { Schema *ast.Schema Resolvers ResolverRoot Directives DirectiveRoot Complexity ComplexityRoot }
type CreateUserInput ¶
type DirectiveRoot ¶
type MutationResolver ¶
type MutationResolver interface { CreateUser(ctx context.Context, input CreateUserInput) (*User, error) DeleteUser(ctx context.Context, id string) (*MutationResponse, error) }
type MutationResponse ¶
type QueryResolver ¶
type Resolver ¶
type Resolver struct{}
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) Subscription ¶
func (r *Resolver) Subscription() SubscriptionResolver
Subscription returns SubscriptionResolver implementation.
type ResolverRoot ¶
type ResolverRoot interface { Mutation() MutationResolver Query() QueryResolver Subscription() SubscriptionResolver }
type Stub ¶
type Stub struct { MutationResolver struct { CreateUser func(ctx context.Context, input CreateUserInput) (*User, error) DeleteUser func(ctx context.Context, id string) (*MutationResponse, error) } QueryResolver struct { GetUser func(ctx context.Context, id string) (*User, error) ListUsers func(ctx context.Context, filter *UserFilter) ([]*User, error) GetEntity func(ctx context.Context, id string) (Entity, error) } SubscriptionResolver struct { UserCreated func(ctx context.Context) (<-chan *User, error) } }
func (*Stub) Mutation ¶
func (r *Stub) Mutation() MutationResolver
func (*Stub) Query ¶
func (r *Stub) Query() QueryResolver
func (*Stub) Subscription ¶
func (r *Stub) Subscription() SubscriptionResolver
type Subscription ¶
type Subscription struct { }
type SubscriptionResolver ¶
Click to show internal directories.
Click to hide internal directories.