Documentation
¶
Index ¶
- Variables
- func Contains(str1, str2 string) bool
- func Cut(in, tag string) []string
- func Equals(str1, str2 string) bool
- func ExtractNumber(str string) string
- func ExtractYear(str string) string
- func GetSets() map[string]mtgjson.Set
- func GetUUIDs() map[string]cardobject
- func HasPrefix(str1, str2 string) bool
- func HasPromoPackPrinting(name string) bool
- func IsBasicLand(name string) bool
- func LoadDatastore(reader io.Reader) error
- func Match(inCard *Card) (cardId string, err error)
- func NewDatastore(ap mtgjson.AllPrintings)
- func Normalize(str string) string
- func SetGlobalLogger(userLogger *log.Logger)
- func SplitVariants(str string) []string
- type AliasingError
- type Card
Constants ¶
This section is empty.
Variables ¶
Date since BuyABox cards are found in the expansion set instead of Promos
var EditionTable = map[string]string{}/* 392 elements not displayed */
var ErrAliasing = newAliasingError()
var ErrCardDoesNotExist = errors.New("unknown card name")
var ErrCardNotInEdition = errors.New("unknown edition")
var ErrCardUnknownId = errors.New("unknown id")
var ErrCardWrongVariant = errors.New("unknown variant")
var ErrDatastoreEmpty = errors.New("datastore is empty")
Date since any card could be Prerelease Promo
Date in which random promos can be in the expansion set
var VariantsTable = map[string]map[string]map[string]string{
"Alliances": allVariants,
"Anthologies": athVariants,
"Antiquities": atqVariants,
"Arena League 2001": pal01Variants,
"Asia Pacific Land Program": palpVariants,
"Battle Royale Box Set": brbVariants,
"Champions of Kamigawa": chkVariants,
"Chronicles": chrVariants,
"Collectors’ Edition": oldLandVariants,
"Commander Anthology Volume II": cm2Variants,
"Conspiracy: Take the Crown": cn2Variants,
"Deckmasters": dkmVariants,
"Fallen Empires": femVariants,
"Fifth Edition": ed5Variants,
"Fourth Edition": ed4Variants,
"GRN Ravnica Weekend": prwkVariants,
"Homelands": hmlVariants,
"Ice Age": iceVariants,
"Intl. Collectors’ Edition": oldLandVariants,
"Introductory Two-Player Set": itpVariants,
"Limited Edition Alpha": leaVariants,
"Limited Edition Beta": oldLandVariants,
"Magic Premiere Shop 2005": pmpsVariants,
"Mirage": mirVariants,
"Oath of the Gatewatch": ogwVariants,
"Portal Second Age": po2Variants,
"Portal": porVariants,
"Pro Tour Collector Set": ptcVariants,
"Rinascimento": rinVariants,
"RNA Ravnica Weekend": prw2Variants,
"Revised Edition": ed3Variants,
"Secret Lair Drop": sldVariants,
"Shadows over Innistrad Promos": psoiVariants,
"Shadows over Innistrad": soiVariants,
"Tempest": tmpVariants,
"Unlimited Edition": oldLandVariants,
"Unstable": ustVariants,
"World Championship Decks 1997": wc97Variants,
"World Championship Decks 1998": wc98Variants,
"World Championship Decks 1999": wc99Variants,
"World Championship Decks 2001": wc01Variants,
"World Championship Decks 2002": wc02Variants,
}
Functions ¶
func Cut ¶
Cut splits the input string in two segments, stripping any whitespace before or after the cut, if present.
func ExtractNumber ¶
ExtractNumber returns as string with _first_ number below 1993 found in a given string, or an empty string if none could be found. The input string may have a single character as prefix or suffix (but not both), which will be ignored while determining the number portion, but preserved, in lowercase if suffix, or as-is if prefix. Any leading # characters or parenthesis are stripped away. Numbers starting with M are ignored because they could be confused with core set names. If a month name is detected anywhere in the input string, an empty string is returned, to prevent confusing a number with a date or day. If a rational number is provided, only the numerator part is considered.
func ExtractYear ¶
ExtractYear returns as string with _first_ year after 1993 found in a given string, or an empty string if nothing is found. It takes care of some special characters like parenthesis (ignored) and abbreviations (so '06 becomes 2006).
func HasPromoPackPrinting ¶
func IsBasicLand ¶
Returns whether the input string may represent a basic land
func LoadDatastore ¶
func NewDatastore ¶
func NewDatastore(ap mtgjson.AllPrintings)
func Normalize ¶
Normalize uses the rules defined in Replacer to replace uncommon elements of card names, dropping all the spaces and producing a lowercase string.
func SetGlobalLogger ¶
func SplitVariants ¶
SplitVariants returns an array of strings from the parentheses-defined fields commonly used to distinguish some cards across editions.
Types ¶
type AliasingError ¶
type AliasingError struct {
// contains filtered or unexported fields
}
func (*AliasingError) Error ¶
func (err *AliasingError) Error() string
func (*AliasingError) Probe ¶
func (err *AliasingError) Probe() []string
type Card ¶
type Card struct { // The mtgjson unique identifier of the card // When used as input it can host mtgjson or scryfall id Id string // The canonical name of the card Name string // The hint or commonly know variation Variation string // The set the card comes from, or a portion of it Edition string // Whether the card is foil or not Foil bool // The collector number of the card (output only) Number string }
Card is a generic card representation using fields defined by the MTGJSON project.
func (*Card) IsBasicLand ¶
Returns whether the card is a basic land