card

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Card

type Card struct {
	Id          sql.NullInt64
	CardSetCode string
	Name        string
	Number      string
	Border      string
	Rarity      string
	Layout      string
	Faces       []*Face
}

Card A complete card including all faces (sides) and translations. The number of a card is unique per set

func (Card) Diff added in v0.2.0

func (c Card) Diff(other *Card) *api.Changeset

type CharacteristicDao

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

func (*CharacteristicDao) AssignToFace added in v0.2.0

func (d *CharacteristicDao) AssignToFace(faceId int64, typeId int64) error

func (*CharacteristicDao) Create

func (d *CharacteristicDao) Create(name string) (*CharacteristicType, error)

func (*CharacteristicDao) DeleteAssignments

func (d *CharacteristicDao) DeleteAssignments(faceId int64, typeIds ...int64) error

func (*CharacteristicDao) Find

func (d *CharacteristicDao) Find(names ...string) ([]*CharacteristicType, error)

func (*CharacteristicDao) FindAssignments

func (d *CharacteristicDao) FindAssignments(faceId int64) ([]*CharacteristicType, error)

type CharacteristicType

type CharacteristicType struct {
	Id   sql.NullInt64
	Name string
}

CharacteristicType A type of a card. Can be a Cardtype, Subtype or Superype Cardtype: Creature, Artifact, Instant, Enchantment ... Subtype: Archer, Shaman, Nomad, Nymph ... Supertype: Basic, Host, Legendary, Ongoing, Snow, World

type Face added in v0.2.0

type Face struct {
	Id                sql.NullInt64
	Name              string
	Text              string
	FlavorText        string
	TypeLine          string
	MultiverseId      int32
	Artist            string
	ConvertedManaCost float64
	Colors            []string
	HandModifier      string
	LifeModifier      string
	Loyalty           string
	ManaCost          string
	Power             string
	Toughness         string
	Cardtypes         []string // A list of all card types of the card
	Supertypes        []string // A list of card supertypes found before em-dash.
	Subtypes          []string // A list of card subtypes found after em-dash.
	Translations      []Translation
}

Face The face data of a card.

func (Face) Diff added in v0.2.0

func (f Face) Diff(other *Face) *api.Changeset

type PostgresCardDao

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

func NewDao

func (*PostgresCardDao) AddFace added in v0.2.0

func (d *PostgresCardDao) AddFace(cardId int64, f *Face) error

func (*PostgresCardDao) AddTranslation added in v0.2.0

func (d *PostgresCardDao) AddTranslation(faceId int64, t *Translation) error

func (*PostgresCardDao) Count

func (d *PostgresCardDao) Count() (int, error)

func (*PostgresCardDao) CreateCard

func (d *PostgresCardDao) CreateCard(c *Card) error

func (*PostgresCardDao) DeleteAllTranslation added in v0.2.1

func (d *PostgresCardDao) DeleteAllTranslation(faceId int64) error

func (*PostgresCardDao) DeleteFace added in v0.2.0

func (d *PostgresCardDao) DeleteFace(faceId int64) error

func (*PostgresCardDao) DeleteTranslation

func (d *PostgresCardDao) DeleteTranslation(faceId int64, lang string) error

func (*PostgresCardDao) FindAssignedCardTypes added in v0.2.0

func (d *PostgresCardDao) FindAssignedCardTypes(faceId int64) ([]string, error)

func (*PostgresCardDao) FindAssignedFaces added in v0.2.0

func (d *PostgresCardDao) FindAssignedFaces(cardId int64) ([]*Face, error)

func (*PostgresCardDao) FindAssignedSubTypes added in v0.2.0

func (d *PostgresCardDao) FindAssignedSubTypes(faceId int64) ([]string, error)

func (*PostgresCardDao) FindAssignedSuperTypes added in v0.2.0

func (d *PostgresCardDao) FindAssignedSuperTypes(faceId int64) ([]string, error)

func (*PostgresCardDao) FindTranslations

func (d *PostgresCardDao) FindTranslations(faceId int64) ([]*Translation, error)

func (*PostgresCardDao) FindUniqueCard

func (d *PostgresCardDao) FindUniqueCard(set string, number string) (*Card, error)

FindUniqueCard finds the card with the specified set code and number. If no result is found a nil card is returned

func (*PostgresCardDao) UpdateCard

func (d *PostgresCardDao) UpdateCard(c *Card) error

func (*PostgresCardDao) UpdateFace added in v0.2.0

func (d *PostgresCardDao) UpdateFace(f *Face) error

func (*PostgresCardDao) UpdateTranslation

func (d *PostgresCardDao) UpdateTranslation(faceId int64, t *Translation) error

type Service

type Service interface {
	Import(card *Card) error
	Count() (int, error)
}

func NewService

func NewService(dao *PostgresCardDao) Service

type Translation

type Translation struct {
	Name         string
	Text         string
	FlavorText   string
	TypeLine     string
	MultiverseId int32
	Lang         string
}

Translation The translation of the card. Does not include english (the default language).

func (Translation) Diff added in v0.2.0

func (t Translation) Diff(other *Translation) *api.Changeset

type TypeDao

type TypeDao interface {
	Create(name string) (*CharacteristicType, error)
	Find(names ...string) ([]*CharacteristicType, error)
	AssignToFace(faceId int64, typeId int64) error
	FindAssignments(faceId int64) ([]*CharacteristicType, error)
	DeleteAssignments(faceId int64, subTypeIds ...int64) error
}

func NewCardTypeDao

func NewCardTypeDao(db *postgres.DBConnection) TypeDao

func NewSubTypeDao

func NewSubTypeDao(db *postgres.DBConnection) TypeDao

func NewSuperTypeDao

func NewSuperTypeDao(db *postgres.DBConnection) TypeDao

Jump to

Keyboard shortcuts

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