models

package
v0.0.0-...-9262b35 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: MIT Imports: 5 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

Functions

func EncodeCursor

func EncodeCursor(i int) string

Types

type Character

type Character interface {
	IsCharacter()
}

type CharacterFields

type CharacterFields struct {
	ID        string
	Name      string
	FriendIds []string
	AppearsIn []Episode
}

type Droid

type Droid struct {
	CharacterFields
	PrimaryFunction string
}

func (Droid) IsCharacter

func (Droid) IsCharacter()

func (Droid) IsSearchResult

func (Droid) IsSearchResult()

type Episode

type Episode string
const (
	EpisodeNewhope Episode = "NEWHOPE"
	EpisodeEmpire  Episode = "EMPIRE"
	EpisodeJedi    Episode = "JEDI"
)

func (Episode) IsValid

func (e Episode) IsValid() bool

func (Episode) MarshalGQL

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

func (Episode) String

func (e Episode) String() string

func (*Episode) UnmarshalGQL

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

type FriendsConnection

type FriendsConnection struct {
	Ids  []string
	From int
	To   int
}

func (*FriendsConnection) PageInfo

func (f *FriendsConnection) PageInfo() PageInfo

func (*FriendsConnection) TotalCount

func (f *FriendsConnection) TotalCount() int

type FriendsEdge

type FriendsEdge struct {
	Cursor string    `json:"cursor"`
	Node   Character `json:"node"`
}

type Human

type Human struct {
	CharacterFields
	StarshipIds  []string
	HeightMeters float64
	Mass         float64
}

func (*Human) Height

func (h *Human) Height(unit LengthUnit) float64

func (Human) IsCharacter

func (Human) IsCharacter()

func (Human) IsSearchResult

func (Human) IsSearchResult()

type LengthUnit

type LengthUnit string
const (
	LengthUnitMeter LengthUnit = "METER"
	LengthUnitFoot  LengthUnit = "FOOT"
)

func (LengthUnit) IsValid

func (e LengthUnit) IsValid() bool

func (LengthUnit) MarshalGQL

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

func (LengthUnit) String

func (e LengthUnit) String() string

func (*LengthUnit) UnmarshalGQL

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

type PageInfo

type PageInfo struct {
	StartCursor string `json:"startCursor"`
	EndCursor   string `json:"endCursor"`
	HasNextPage bool   `json:"hasNextPage"`
}

type Review

type Review struct {
	Stars      int
	Commentary *string
	Time       time.Time
}

type SearchResult

type SearchResult interface {
	IsSearchResult()
}

type Starship

type Starship struct {
	ID      string  `json:"id"`
	Name    string  `json:"name"`
	Length  float64 `json:"length"`
	History [][]int `json:"history"`
}

func (Starship) IsSearchResult

func (Starship) IsSearchResult()

Jump to

Keyboard shortcuts

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