model

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2019 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidState = errors.New("ErrInvalidState")
)

Functions

func MarshalDateTime added in v0.0.10

func MarshalDateTime(d time.Time) graphql.Marshaler

func NewExecutableSchema added in v0.0.10

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

func NewSchema

func NewSchema(resolver *Resolver) graphql.Schema

func UnmarshalDateTime added in v0.0.10

func UnmarshalDateTime(v interface{}) (time.Time, error)

Types

type Card

type Card struct {
	ID            string     `json:"id"`
	Name          string     `json:"name"`
	Types         []string   `json:"types"`
	Costs         []string   `json:"costs"`
	NumberCost    float64    `json:"numberCost"`
	IDExternal    string     `json:"idExternal"`
	OrderExternal *string    `json:"orderExternal"`
	IDRarity      string     `json:"idRarity"`
	Rarity        *Rarity    `json:"rarity"`
	IDSet         string     `json:"idSet"`
	Set           *Set       `json:"set"`
	IDAsset       string     `json:"idAsset"`
	Rules         []string   `json:"rules"`
	Rate          *float64   `json:"rate"`
	RateVotes     *int       `json:"rateVotes"`
	Artist        *string    `json:"artist"`
	Flavor        *string    `json:"flavor"`
	Data          *Object    `json:"data"`
	CreatedAt     time.Time  `json:"createdAt"`
	UpdatedAt     *time.Time `json:"updatedAt"`
	DeletedAt     *time.Time `json:"deletedAt"`
}

type CardFilter added in v0.0.10

type CardFilter struct {
	Name   *string       `json:"name"`
	Types  []string      `json:"types"`
	Costs  []string      `json:"costs"`
	Set    *SetFilter    `json:"set"`
	Rarity *RarityFilter `json:"rarity"`
}

func UnmarshalCardFilter added in v0.0.10

func UnmarshalCardFilter(v interface{}) (CardFilter, error)

type ComplexityRoot added in v0.0.10

type ComplexityRoot struct {
	Card struct {
		Id            func(childComplexity int) int
		Name          func(childComplexity int) int
		Types         func(childComplexity int) int
		Costs         func(childComplexity int) int
		NumberCost    func(childComplexity int) int
		IdExternal    func(childComplexity int) int
		OrderExternal func(childComplexity int) int
		IdRarity      func(childComplexity int) int
		Rarity        func(childComplexity int) int
		IdSet         func(childComplexity int) int
		Set           func(childComplexity int) int
		IdAsset       func(childComplexity int) int
		Rules         func(childComplexity int) int
		Rate          func(childComplexity int) int
		RateVotes     func(childComplexity int) int
		Artist        func(childComplexity int) int
		Flavor        func(childComplexity int) int
		Data          func(childComplexity int) int
		CreatedAt     func(childComplexity int) int
		UpdatedAt     func(childComplexity int) int
		DeletedAt     func(childComplexity int) int
	}

	Query struct {
		Set    func(childComplexity int, id string) int
		Card   func(childComplexity int, id string) int
		SetBy  func(childComplexity int, filter SetFilter) int
		CardBy func(childComplexity int, filter CardFilter) int
	}

	Rarity struct {
		Id    func(childComplexity int) int
		Name  func(childComplexity int) int
		Alias func(childComplexity int) int
	}

	Set struct {
		Id        func(childComplexity int) int
		Name      func(childComplexity int) int
		Alias     func(childComplexity int) int
		Asset     func(childComplexity int) int
		CreatedAt func(childComplexity int) int
		UpdatedAt func(childComplexity int) int
		DeletedAt func(childComplexity int) int
	}
}

type Config added in v0.0.10

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot added in v0.0.10

type DirectiveRoot struct {
}

type Object added in v0.0.10

type Object map[string]interface{}

func (Object) MarshalGQL added in v0.0.10

func (j Object) MarshalGQL(w io.Writer)

MarshalGQL implements the graphql.Marshaler interface

func (*Object) UnmarshalGQL added in v0.0.10

func (j *Object) UnmarshalGQL(v interface{}) error

UnmarshalGQL implements the graphql.Marshaler interface

type QueryResolver added in v0.0.10

type QueryResolver interface {
	Set(ctx context.Context, id string) (Set, error)
	Card(ctx context.Context, id string) (Card, error)
	SetBy(ctx context.Context, filter SetFilter) ([]Set, error)
	CardBy(ctx context.Context, filter CardFilter) ([]Card, error)
}

func NewFirestoreQueryResolver added in v0.0.11

func NewFirestoreQueryResolver(tree yggdrasil.Tree) QueryResolver

func NewPostgresQueryResolver added in v0.0.11

func NewPostgresQueryResolver(tree yggdrasil.Tree) QueryResolver

type Rarity

type Rarity struct {
	ID    string      `json:"id"`
	Name  RarityName  `json:"name"`
	Alias RarityAlias `json:"alias"`
}

type RarityAlias added in v0.0.10

type RarityAlias string
const (
	RarityAliasC RarityAlias = "C"
	RarityAliasU RarityAlias = "U"
	RarityAliasR RarityAlias = "R"
	RarityAliasM RarityAlias = "M"
	RarityAliasS RarityAlias = "S"
	RarityAliasL RarityAlias = "L"
	RarityAliasP RarityAlias = "P"
	RarityAliasB RarityAlias = "B"
)

func (RarityAlias) IsValid added in v0.0.10

func (e RarityAlias) IsValid() bool

func (RarityAlias) MarshalGQL added in v0.0.10

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

func (RarityAlias) String added in v0.0.10

func (e RarityAlias) String() string

func (*RarityAlias) UnmarshalGQL added in v0.0.10

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

type RarityFilter added in v0.0.10

type RarityFilter struct {
	ID    *string      `json:"id"`
	Name  *RarityName  `json:"name"`
	Alias *RarityAlias `json:"alias"`
}

func UnmarshalRarityFilter added in v0.0.10

func UnmarshalRarityFilter(v interface{}) (RarityFilter, error)

type RarityName added in v0.0.10

type RarityName string
const (
	RarityNameCommon     RarityName = "Common"
	RarityNameUncommon   RarityName = "Uncommon"
	RarityNameRare       RarityName = "Rare"
	RarityNameMythicRare RarityName = "MythicRare"
	RarityNameSpecial    RarityName = "Special"
	RarityNameLand       RarityName = "Land"
	RarityNamePromo      RarityName = "Promo"
	RarityNameBonus      RarityName = "Bonus"
)

func (RarityName) IsValid added in v0.0.10

func (e RarityName) IsValid() bool

func (RarityName) MarshalGQL added in v0.0.10

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

func (RarityName) String added in v0.0.10

func (e RarityName) String() string

func (*RarityName) UnmarshalGQL added in v0.0.10

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

type Resolver added in v0.0.10

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

func NewResolver added in v0.0.10

func NewResolver(queryResolver QueryResolver) *Resolver

func (*Resolver) Query added in v0.0.10

func (r *Resolver) Query() QueryResolver

type ResolverRoot added in v0.0.10

type ResolverRoot interface {
	Query() QueryResolver
}

type Set

type Set struct {
	ID        string     `json:"id"`
	Name      string     `json:"name"`
	Alias     string     `json:"alias"`
	Asset     Object     `json:"asset"`
	CreatedAt time.Time  `json:"createdAt"`
	UpdatedAt *time.Time `json:"updatedAt"`
	DeletedAt *time.Time `json:"deletedAt"`
}

type SetFilter added in v0.0.10

type SetFilter struct {
	ID    *string `json:"id"`
	Name  *string `json:"name"`
	Alias *string `json:"alias"`
}

func UnmarshalSetFilter added in v0.0.10

func UnmarshalSetFilter(v interface{}) (SetFilter, error)

Jump to

Keyboard shortcuts

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