model

package
v0.0.0-...-7f34883 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: GPL-3.0 Imports: 13 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 {
		FindLanguageByID func(childComplexity int, id string) int
		FindProjectByID  func(childComplexity int, id string) int
		FindResourceByID func(childComplexity int, id string) int
	}

	KeyValue struct {
		Key   func(childComplexity int) int
		Value func(childComplexity int) int
	}

	Language struct {
		ID   func(childComplexity int) int
		Name func(childComplexity int) int
	}

	Mutation struct {
		DeleteResource func(childComplexity int, projectID string, languageID string, semver string) int
		NewLanguage    func(childComplexity int, id string, name string) int
		NewProject     func(childComplexity int, id string, name string) int
		NewResource    func(childComplexity int, request NewResourceInput) int
	}

	Project struct {
		ID   func(childComplexity int) int
		Name func(childComplexity int) int
	}

	Query struct {
		GetLanguage func(childComplexity int, id string) int
		GetProject  func(childComplexity int, id string) int
		GetResource func(childComplexity int, projectID string, languageID string, semver string) int
		GetVersions func(childComplexity int, projectID string, languageID string) int
		// contains filtered or unexported fields
	}

	Resource struct {
		ID         func(childComplexity int) int
		LanguageID func(childComplexity int) int
		ProjectID  func(childComplexity int) int
		Semver     func(childComplexity int) int
		Values     func(childComplexity int) int
	}
	// 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 {
	FindLanguageByID(ctx context.Context, id string) (*Language, error)
	FindProjectByID(ctx context.Context, id string) (*Project, error)
	FindResourceByID(ctx context.Context, id string) (*Resource, error)
}

type EntityWithIndex

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

type KeyValue

type KeyValue struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type KeyValueInput

type KeyValueInput struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type Language

type Language struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

func (Language) IsEntity

func (Language) IsEntity()

type Mutation

type Mutation struct {
}

type MutationResolver

type MutationResolver interface {
	NewProject(ctx context.Context, id string, name string) (string, error)
	NewLanguage(ctx context.Context, id string, name string) (string, error)
	NewResource(ctx context.Context, request NewResourceInput) (string, error)
	DeleteResource(ctx context.Context, projectID string, languageID string, semver string) (string, error)
}

type NewResourceInput

type NewResourceInput struct {
	ProjectID  string           `json:"projectId"`
	LanguageID string           `json:"languageId"`
	Semver     string           `json:"semver"`
	Values     []*KeyValueInput `json:"values"`
}

type Project

type Project struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

func (Project) IsEntity

func (Project) IsEntity()

type Query

type Query struct {
}

type QueryResolver

type QueryResolver interface {
	GetProject(ctx context.Context, id string) (*Project, error)
	GetLanguage(ctx context.Context, id string) (*Language, error)
	GetResource(ctx context.Context, projectID string, languageID string, semver string) (*Resource, error)
	GetVersions(ctx context.Context, projectID string, languageID string) ([]string, error)
}

type ResolverRoot

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

type Resource

type Resource struct {
	ID         string      `json:"id"`
	ProjectID  string      `json:"projectId"`
	LanguageID string      `json:"languageId"`
	Semver     string      `json:"semver"`
	Values     []*KeyValue `json:"values"`
}

func (Resource) IsEntity

func (Resource) IsEntity()

Jump to

Keyboard shortcuts

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