mtgjson

package
v0.0.0-...-4688aa9 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadCollection

func LoadCollection(path string) (map[string]Set, error)

LoadCollection unmarshals a mtgjson.com data dump into Set & Card structs

Types

type Card

type Card struct {
	ID          uint32    `json:"-"`
	MTGJsonID   string    `json:"id" db:"mtg_json_id"`
	SetCode     string    `json:"setCode" db:"set_code"`
	SetName     string    `json:"setName" db:"set_name"`
	ReleaseDate time.Time `json:"date" db:"release_date"`
	Layout      string    `json:"layout"`

	Power     string `json:"power,omitempty"`
	Toughness string `json:"toughness,omitempty"`
	Loyalty   int    `json:"loyalty,omitempty"`
	Hand      int    `json:"hand,omitempty"`
	Life      int    `json:"life,omitempty"`

	CMC      float32 `json:"cmc,omitempty"`
	ManaCost string  `json:"manaCost" db:"mana_cost"`

	Name       string      `json:"name"`
	Names      StringSlice `json:"names,omitempty"`
	SearchName string      `json:"search_name,omitempty" db:"search_name"`
	//ForeignNames []ForeignName `json:"foreignNames,omitempty"`
	Type       string      `json:"type"`
	Supertypes StringSlice `json:"supertypes" db:"super_types"`
	Types      StringSlice `json:"types"`
	Subtypes   StringSlice `json:"subtypes" db:"sub_types"`
	Colors     StringSlice `json:"colors"`
	Rarity     string      `json:"rarity"`
	Text       string      `json:"text"`

	Timeshifted bool `json:"timeshifted,omitempty"`
	Reserved    bool `json:"reserved,omitempty"`
	Starter     bool `json:"starter"`

	Flavor string `json:"flavor"`

	MultiverseID int    `json:"multiverseid" db:"multiverse_id"`
	Number       string `json:"number"`
	//	Variations   []int  `json:"variations,omitempty"` // MULTIVID
	Source    string `json:"source,omitempty"`
	Watermark string `json:"watermark,omitempty"`
	Artist    string `json:"artist"`
	ImageName string `json:"imageName" db:"image_name"`

	URL      string `json:"url,omitempty"`
	ImageURL string `json:"image_url,omitempty"`
	SetURL   string `json:"set_url,omitempty"`
}

Card represents a Magic Card from a particular set

func (*Card) IsBasicLand

func (c *Card) IsBasicLand() bool

IsBasicLand returns true if the card is a basic land type

type ForeignName

type ForeignName struct {
	Lang         string `json:"language"`
	Name         string `json:"name"`
	MultiverseID int    `json:"multiverseid"` // MULTIVID
}

type Legality

type Legality struct {
	Format   string `json:"format"`
	Legality string `json:"legality"`
}

type Ruling

type Ruling struct {
	Date string `json:"date"`
	Text string `json:"text"`
}

type Set

type Set struct {
	Name               string  `json:"name"`
	Code               string  `json:"code"`
	GathererCode       string  `json:"gathererCode,omitempty"`
	OldCode            string  `json:"oldCode,omitempty"`
	MagicCardsInfoCode string  `json:"magicCardsInfoCode,omitempty"`
	ReleaseDate        string  `json:"releaseDate"`
	Border             string  `json:"border"`
	SetType            string  `json:"type"`
	Block              string  `json:"block"`
	OnlineOnly         bool    `json:"onlineOnly,omitempty"`
	Cards              []*Card `json:"cards"`
}

Set represents a particular set of magic cards

type StringSlice

type StringSlice []string

StringSlice implements the Valuer/Scanner interfaces to save to the database

func (*StringSlice) Scan

func (s *StringSlice) Scan(src interface{}) error

Scan implements the Scanner interface for database/sql

func (StringSlice) ToLower

func (s StringSlice) ToLower() StringSlice

ToLower returns a new StringSlice with all elemets lowercased

func (StringSlice) Value

func (s StringSlice) Value() (driver.Value, error)

Value implements the Valuer interface for SQL operations

Jump to

Keyboard shortcuts

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