Documentation ¶
Index ¶
- Variables
- func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
- type ComplexityRoot
- type Config
- type CreateUserInput
- type CreateUserOutput
- type CreateUserOutputMetadata
- type DirectiveRoot
- type Mutation
- type MutationResolver
- type MutationStatus
- type Query
- type QueryResolver
- type Resolver
- type ResolverRoot
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var AllMutationStatus = []MutationStatus{ MutationStatusSuccess, MutationStatusAlreadyExists, MutationStatusFailure, MutationStatusValidationError, }
Functions ¶
func NewExecutableSchema ¶
func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.
Types ¶
type ComplexityRoot ¶
type ComplexityRoot struct { CreateUserOutput struct { ErrorMessage func(childComplexity int) int Metadata func(childComplexity int) int Status func(childComplexity int) int } CreateUserOutputMetadata struct { User func(childComplexity int) int } Mutation struct { CreateUser func(childComplexity int, input CreateUserInput) int } Query struct { User func(childComplexity int, id string) int } User struct { Email func(childComplexity int) int ID func(childComplexity int) int Name func(childComplexity int) int } }
type Config ¶
type Config struct { Schema *ast.Schema Resolvers ResolverRoot Directives DirectiveRoot Complexity ComplexityRoot }
type CreateUserInput ¶
type CreateUserInput struct { // 名前 Name string `json:"name"` // メールアドレス Email string `json:"email"` }
Create User Input
type CreateUserOutput ¶
type CreateUserOutput struct { // 作成した結果 Status MutationStatus `json:"status"` // error message ErrorMessage *string `json:"errorMessage,omitempty"` // metadata Metadata *CreateUserOutputMetadata `json:"metadata,omitempty"` }
Create User Output
type CreateUserOutputMetadata ¶
type CreateUserOutputMetadata struct { // 作成したユーザ情報 User *User `json:"user,omitempty"` }
type DirectiveRoot ¶
type DirectiveRoot struct { }
type MutationResolver ¶
type MutationResolver interface {
CreateUser(ctx context.Context, input CreateUserInput) (*CreateUserOutput, error)
}
type MutationStatus ¶
type MutationStatus string
Mutationの処理結果
const ( // 成功 MutationStatusSuccess MutationStatus = "SUCCESS" // 作成済み MutationStatusAlreadyExists MutationStatus = "ALREADY_EXISTS" // 失敗 MutationStatusFailure MutationStatus = "FAILURE" // バリデーションエラー MutationStatusValidationError MutationStatus = "VALIDATION_ERROR" )
func (MutationStatus) IsValid ¶
func (e MutationStatus) IsValid() bool
func (MutationStatus) MarshalGQL ¶
func (e MutationStatus) MarshalGQL(w io.Writer)
func (MutationStatus) String ¶
func (e MutationStatus) String() string
func (*MutationStatus) UnmarshalGQL ¶
func (e *MutationStatus) UnmarshalGQL(v interface{}) error
type QueryResolver ¶
type Resolver ¶
func (*Resolver) Mutation ¶
func (r *Resolver) Mutation() MutationResolver
Mutation returns MutationResolver implementation.
func (*Resolver) Query ¶
func (r *Resolver) Query() QueryResolver
Query returns QueryResolver implementation.
type ResolverRoot ¶
type ResolverRoot interface { Mutation() MutationResolver Query() QueryResolver }
Click to show internal directories.
Click to hide internal directories.