Documentation
¶
Index ¶
- 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 RoleModel
- type Stub
- type Subscription
- type SubscriptionResolver
- type User
- type UserFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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 = graphql.Config[ResolverRoot, DirectiveRoot, ComplexityRoot]
type CreateUserInput ¶
type CreateUserInput struct {
Name string `json:"name"`
Email string `json:"email"`
Age *int `json:"age,omitempty"`
Role *RoleModel `json:"role,omitempty"`
}
func UnmarshalCreateUserInput ¶ added in v0.17.96
func UnmarshalCreateUserInput(ctx context.Context, raw any) (CreateUserInput, error)
UnmarshalCreateUserInput unmarshals raw into the CreateUserInput input type, using the unmarshaler bound to ctx's request. Call it from a resolver to decode an input object that was not passed as a field argument.
ctx must come from a gqlgen request; outside one there is no unmarshaler to use and the returned error says so.
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 graphql.Event[*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 ¶
type User ¶
type User struct {
ID string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
Age *int `json:"age,omitempty"`
Role RoleModel `json:"role"`
CreatedAt *string `json:"createdAt,omitempty"`
}
func (User) GetCreatedAt ¶
type UserFilter ¶
type UserFilter struct {
Name *string `json:"name,omitempty"`
Email *string `json:"email,omitempty"`
Age *int `json:"age,omitempty"`
Roles []RoleModel `json:"roles,omitempty"`
IsActive *bool `json:"isActive,omitempty"`
}
func UnmarshalUserFilter ¶ added in v0.17.96
func UnmarshalUserFilter(ctx context.Context, raw any) (UserFilter, error)
UnmarshalUserFilter unmarshals raw into the UserFilter input type, using the unmarshaler bound to ctx's request. Call it from a resolver to decode an input object that was not passed as a field argument.
ctx must come from a gqlgen request; outside one there is no unmarshaler to use and the returned error says so.