model

package
v0.0.0-...-d440da4 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Up   = "Up"
	Down = "Down"
)

Variables

This section is empty.

Functions

func HandleServerResponse

func HandleServerResponse(apiErr APIError, res http.ResponseWriter)

Types

type APIError

type APIError struct {
	Message    string `json:"message"`
	StatusCode int    `json:"-"`
}

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) HandleServerResponse

func (e *APIError) HandleServerResponse(res http.ResponseWriter)

type APIHealth

type APIHealth struct {
	Version    string           `json:"version"`
	Downstream []DownstreamItem `json:"downstream"`
}

type BatchCardData

type BatchCardData[IS IdentifierSlice] struct {
	CardInfo         CardDataMap `json:"cardInfo"`
	UnknownResources IS          `json:"unknownResources"`
}

type BatchCardIDs

type BatchCardIDs struct {
	CardIDs CardIDs `json:"cardIDs" validate:"required,ygocardids"`
}

type BatchData

type BatchData[IS IdentifierSlice] interface {
	BatchCardData[IS]
}

type Card

type Card struct {
	CardID         string  `db:"card_number" json:"cardID"`
	CardColor      string  `db:"card_color" json:"cardColor"`
	CardName       string  `db:"card_name" json:"cardName"`
	CardAttribute  string  `db:"card_attribute" json:"cardAttribute"`
	CardEffect     string  `db:"card_effect" json:"cardEffect"`
	MonsterType    *string `db:"monster_type" json:"monsterType,omitempty"`
	MonsterAttack  *uint16 `db:"monster_attack" json:"monsterAttack,omitempty"`
	MonsterDefense *uint16 `db:"monster_defense" json:"monsterDefense,omitempty"`
}

func (Card) IsExtraDeckMonster

func (c Card) IsExtraDeckMonster() bool

type CardDataMap

type CardDataMap map[string]Card

func (CardDataMap) FindMissingIDs

func (cardData CardDataMap) FindMissingIDs(cardIDs CardIDs) CardIDs

finds all card IDs not found in CardDataMap keys

func (CardDataMap) FindMissingNames

func (cardData CardDataMap) FindMissingNames(cardNames CardNames) CardNames

finds all card IDs not found in CardDataMap keys

type CardIDs

type CardIDs []string

type CardNames

type CardNames []string

type Cards

type Cards []Card

func (Cards) SortCardsByName

func (cards Cards) SortCardsByName()

type Content

type Content struct {
	Quantity int  `bson:"omitempty" json:"quantity"`
	Card     Card `bson:"omitempty" json:"card"`
}

type DeckList

type DeckList struct {
	ID                primitive.ObjectID `bson:"_id,omitempty" json:"id"`
	Name              string             `bson:"name" json:"name" validate:"required,decklistname"`
	ContentB64        string             `bson:"content" json:"content" validate:"required,base64"`
	VideoUrl          string             `bson:"videoUrl" json:"videoUrl" validate:"omitempty,url"`
	UniqueCards       CardIDs            `bson:"uniqueCards" json:"uniqueCards" validate:"omitempty"`
	DeckMascots       CardIDs            `bson:"deckMascots" json:"deckMascots" validate:"omitempty,deckmascots"`
	NumMainDeckCards  int                `bson:"numMainDeckCards" json:"numMainDeckCards"`
	NumExtraDeckCards int                `bson:"numExtraDeckCards" json:"numExtraDeckCards"`
	Tags              []string           `bson:"tags" json:"tags" validate:"required"`
	CreatedAt         time.Time          `bson:"createdAt" json:"createdAt"`
	UpdatedAt         time.Time          `bson:"updatedAt" json:"updatedAt"`
	MainDeck          []Content          `bson:"mainDeck,omitempty" json:"mainDeck,omitempty"`
	ExtraDeck         []Content          `bson:"extraDeck,omitempty" json:"extraDeck,omitempty"`
}

type DeckListBreakdown

type DeckListBreakdown struct {
	CardQuantity      map[string]int
	CardIDs           CardIDs
	InvalidIDs        CardIDs
	AllCards          CardDataMap
	MainDeck          Cards
	ExtraDeck         Cards
	NumMainDeckCards  int
	NumExtraDeckCards int
}

func (*DeckListBreakdown) GetQuantities

func (dlb *DeckListBreakdown) GetQuantities() ([]Content, []Content)

func (DeckListBreakdown) ListStringCleanup

func (dlb DeckListBreakdown) ListStringCleanup() string

func (*DeckListBreakdown) Partition

func (dlb *DeckListBreakdown) Partition()

func (*DeckListBreakdown) Sort

func (dlb *DeckListBreakdown) Sort()

func (DeckListBreakdown) Validate

func (dlb DeckListBreakdown) Validate(ctx context.Context) *APIError

type DownstreamItem

type DownstreamItem struct {
	ServiceName string `json:"serviceName"`
	Status      Status `json:"status"`
}

type IdentifierSlice

type IdentifierSlice interface {
	CardIDs | CardNames
}

type QuotedToken

type QuotedToken = string

type ResourceDataMap

type ResourceDataMap interface {
	CardDataMap
}

type Status

type Status string

type Success

type Success struct {
	Message string `json:"message"`
}

type SuggestedDecks

type SuggestedDecks struct {
	FeaturedIn *[]DeckList `json:"featuredIn"`
}

Jump to

Keyboard shortcuts

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