pokemon

package
v1.31.5-0...-ff97089 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(e *echo.Echo, db *pg.DB, nonEnforceAuth echo.MiddlewareFunc)

RegisterRoutes takes in an Echo router and registers routes onto it.

Types

type Evolution

type Evolution struct {
	EvolvingPokemonID int               `json:"-"`
	EvolvingPokemon   *EvolutionPokemon `pg:"evolving,rel:has-one" json:"-"`
	EvolvedPokemonID  int               `json:"-"`
	EvolvedPokemon    *EvolutionPokemon `pg:"evolved,rel:has-one" json:"-"`
	EvolutionFamilyID int               `json:"-"`
	Stage             int               `json:"-"`
	Trigger           string            `json:"trigger"`
	Level             *int              `json:"level,omitempty"`
	CandyCount        *int              `json:"candy_count,omitempty"`
	Stone             *string           `json:"stone,omitempty"`
	HeldItem          *string           `json:"held_item,omitempty"`
	Notes             *string           `json:"notes,omitempty"`
	DateCreated       time.Time         `json:"-"`
	DateModified      time.Time         `json:"-"`
	// contains filtered or unexported fields
}

type EvolutionFamily

type EvolutionFamily struct {
	Pokemon    [][]*EvolutionPokemon `json:"pokemon"`
	Evolutions [][]*Evolution        `json:"evolutions"`
}

type EvolutionPokemon

type EvolutionPokemon struct {
	ID           int               `json:"id"`
	NationalID   int               `json:"national_id"`
	Name         string            `json:"name"`
	GameFamilyID string            `json:"-"`
	GameFamily   *games.GameFamily `pg:"gf,rel:has-one" json:"-"`
	Form         *string           `json:"form"`
	// contains filtered or unexported fields
}

type ListPokemonOptions

type ListPokemonOptions struct {
	IDs []int
}

type Location

type Location struct {
	GameID    string      `json:"-"`
	Game      *games.Game `pg:"g,rel:has-one" json:"game"`
	PokemonID int         `json:"-"`
	Value     string      `json:"value"`
	Values    []string    `pg:",array" json:"values"`
	// contains filtered or unexported fields
}

func (*Location) MarshalJSON

func (l *Location) MarshalJSON() ([]byte, error)

MarshalJSON is just needed for parity testing. Once we're actually using this in production, we can remove it.

type Pokemon

type Pokemon struct {
	ID                int               `json:"id"`
	NationalID        int               `json:"national_id"`
	Name              string            `json:"name"`
	GameFamilyID      string            `json:"-"`
	GameFamily        *games.GameFamily `pg:"gf,rel:has-one" json:"game_family"`
	Form              *string           `json:"form"`
	Box               *string           `pg:"-" json:"box"`
	DexNumber         int               `pg:"-" json:"dex_number"`
	Locations         []*Location       `pg:"l,rel:has-many" json:"locations"`
	NationalOrder     int               `json:"-"`
	EvolutionFamilyID int               `json:"-"`
	EvolutionFamily   *EvolutionFamily  `pg:"-" json:"evolution_family"`
	DateCreated       time.Time         `json:"-"`
	DateModified      time.Time         `json:"-"`
	// contains filtered or unexported fields
}

type RetrieveEvolutionFamilyOptions

type RetrieveEvolutionFamilyOptions struct {
	EvolutionFamilyID *int
	DexTypeID         *int
	GameFamilyID      *string
}

type RetrievePokemonOptions

type RetrievePokemonOptions struct {
	ID      *int
	DexType *dextypes.DexType
}

type Service

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

func NewService

func NewService(db *pg.DB) *Service

func (*Service) ListPokemon

func (svc *Service) ListPokemon(ctx context.Context, opts ListPokemonOptions) ([]*Pokemon, error)

func (*Service) RetrieveEvolutionFamily

func (svc *Service) RetrieveEvolutionFamily(ctx context.Context, opts RetrieveEvolutionFamilyOptions) (*EvolutionFamily, error)

func (*Service) RetrievePokemon

func (svc *Service) RetrievePokemon(ctx context.Context, opts RetrievePokemonOptions) (*Pokemon, error)

Jump to

Keyboard shortcuts

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