graph

package
v0.0.0-...-01a1143 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 {
		CreateProduct func(childComplexity int, input model.ProductInput) int
		PlaceOrder    func(childComplexity int, input model.OrderInput) int
		RegisterUser  func(childComplexity int, input model.RegisterInput) int
	}

	Order struct {
		CreatedAt  func(childComplexity int) int
		ID         func(childComplexity int) int
		ProductID  func(childComplexity int) int
		Quantity   func(childComplexity int) int
		Status     func(childComplexity int) int
		TotalPrice func(childComplexity int) int
		UpdatedAt  func(childComplexity int) int
		UserID     func(childComplexity int) int
	}

	Product struct {
		CreatedAt   func(childComplexity int) int
		Description func(childComplexity int) int
		ID          func(childComplexity int) int
		Name        func(childComplexity int) int
		Price       func(childComplexity int) int
		Stock       func(childComplexity int) int
		UpdatedAt   func(childComplexity int) int
	}

	Query struct {
		Order    func(childComplexity int, id string) int
		Orders   func(childComplexity int) int
		Product  func(childComplexity int, id string) int
		Products func(childComplexity int) int
		User     func(childComplexity int, id string) int
		Users    func(childComplexity int) int
	}

	User struct {
		CreatedAt func(childComplexity int) int
		Email     func(childComplexity int) int
		ID        func(childComplexity int) int
		UpdatedAt func(childComplexity int) int
		Username  func(childComplexity int) int
	}
}

type Config

type Config struct {
	Schema     *ast.Schema
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
}

type MutationResolver

type MutationResolver interface {
	RegisterUser(ctx context.Context, input model.RegisterInput) (*model.User, error)
	CreateProduct(ctx context.Context, input model.ProductInput) (*model.Product, error)
	PlaceOrder(ctx context.Context, input model.OrderInput) (*model.Order, error)
}

type OrderService

type OrderService interface {
	GetOrders() ([]*model.Order, error)
	GetOrderByID(id string) (*model.Order, error)
	PlaceOrder(input model.OrderInput) (*model.Order, error)
}

type ProductService

type ProductService interface {
	GetProducts() ([]*model.Product, error)
	GetProductByID(id string) (*model.Product, error)
	CreateProduct(input model.ProductInput) (*model.Product, error)
}

type QueryResolver

type QueryResolver interface {
	Users(ctx context.Context) ([]*model.User, error)
	User(ctx context.Context, id string) (*model.User, error)
	Products(ctx context.Context) ([]*model.Product, error)
	Product(ctx context.Context, id string) (*model.Product, error)
	Orders(ctx context.Context) ([]*model.Order, error)
	Order(ctx context.Context, id string) (*model.Order, error)
}

type Resolver

type Resolver struct {
	ProductService ProductService
	OrderService   OrderService
}

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
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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