graph

package
v0.0.0-...-be31693 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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 Mutation

type Mutation struct {
}

Mutation

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 Query

type Query struct {
}

Query

type QueryResolver

type QueryResolver interface {
	User(ctx context.Context, id string) (*User, error)
}

type Resolver

type Resolver struct {
	DBClient      *db.Queries
	MetricsClient *metrics.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.

type ResolverRoot

type ResolverRoot interface {
	Mutation() MutationResolver
	Query() QueryResolver
}

type User

type User struct {
	// ユーザID
	ID string `json:"id"`
	// 名前
	Name string `json:"name"`
	// メールアドレス
	Email string `json:"email"`
}

User Information

Jump to

Keyboard shortcuts

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