model

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownType  = errors.New("unknown type")
	ErrTypeNotFound = errors.New("type not found")
)

Functions

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

Types

type ComplexityRoot

type ComplexityRoot struct {
	Entity struct {
		FindImageByID func(childComplexity int, id string) int
	}

	Image struct {
		ID    func(childComplexity int) int
		Image func(childComplexity int) int
	}

	Mutation struct {
		CreateImage func(childComplexity int, imageBase64 string) int
	}

	Query struct {
		GetImage func(childComplexity int, id string, size ImageSize) int
		// contains filtered or unexported fields
	}
	// contains filtered or unexported fields
}

type Config

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

type DirectiveRoot

type DirectiveRoot struct {
}

type EntityRepresentation

type EntityRepresentation map[string]any

EntityRepresentation is the JSON representation of an entity sent by the Router used as the inputs for us to resolve.

We make it a map because we know the top level JSON is always an object.

type EntityResolver

type EntityResolver interface {
	FindImageByID(ctx context.Context, id string) (*Image, error)
}

type EntityWithIndex

type EntityWithIndex struct {
	// contains filtered or unexported fields
}

type Image

type Image struct {
	ID    string `json:"id"`
	Image string `json:"image"`
}

func (Image) IsEntity

func (Image) IsEntity()

type ImageSize

type ImageSize string
const (
	ImageSizeSize160  ImageSize = "SIZE_160"
	ImageSizeSize320  ImageSize = "SIZE_320"
	ImageSizeSize640  ImageSize = "SIZE_640"
	ImageSizeSize800  ImageSize = "SIZE_800"
	ImageSizeSize1024 ImageSize = "SIZE_1024"
	ImageSizeSize1200 ImageSize = "SIZE_1200"
	ImageSizeOriginal ImageSize = "ORIGINAL"
)

func (ImageSize) IsValid

func (e ImageSize) IsValid() bool

func (ImageSize) MarshalGQL

func (e ImageSize) MarshalGQL(w io.Writer)

func (ImageSize) String

func (e ImageSize) String() string

func (*ImageSize) UnmarshalGQL

func (e *ImageSize) UnmarshalGQL(v interface{}) error

type Mutation

type Mutation struct {
}

type MutationResolver

type MutationResolver interface {
	CreateImage(ctx context.Context, imageBase64 string) (string, error)
}

type Query

type Query struct {
}

type QueryResolver

type QueryResolver interface {
	GetImage(ctx context.Context, id string, size ImageSize) (*Image, error)
}

type ResolverRoot

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

Jump to

Keyboard shortcuts

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