Documentation
¶
Index ¶
- Constants
- func AddCards(database *server.Database, deck *deckModel.Deck, ...) error
- func AllCardIds(contents *deckModel.DeckContentIds) []string
- func DeleteDeck(database *server.Database, code string, owner string) error
- func GetDeck(database *server.Database, code string, owner string) (*deckModel.Deck, error)
- func GetDeckContents(database *server.Database, deck *deckModel.Deck) (*deckModel.DeckContents, error)
- func IndexDecks(database *server.Database, limit int64) ([]*deckModel.Deck, error)
- func NewDeck(database *server.Database, deck *deckModel.Deck, owner string) error
- func RemoveCards(database *server.Database, deck *deckModel.Deck, ...) error
- func ReplaceDeck(database *server.Database, deck *deckModel.Deck) error
Constants ¶
const ( BoardMainboard = "mainBoard" BoardSideboard = "sideBoard" BoardCommander = "commander" )
Variables ¶
This section is empty.
Functions ¶
func AddCards ¶ added in v1.1.9
func AddCards(database *server.Database, deck *deckModel.Deck, contents *deckModel.DeckContentIds) error
AddCards - Add cards to a deck within the database. Deck must have a Deck Code associated with it or it will error out. Does not validate cards
func AllCardIds ¶ added in v1.1.9
func AllCardIds(contents *deckModel.DeckContentIds) []string
AllCardIds - Takes a deckModel.DeckContentIds structure and retuns a single slice of strings representing all the cardIds across each board
func DeleteDeck ¶
DeleteDeck Remove a deck from the MongoDB database using the code passed in the parameter. Returns ErrNoDeck if the deck does not exist. Returns ErrDeckDeleteFailed if the deleted count does not equal 1
func GetDeck ¶
GetDeck Fetch a deck from the MongoDB database using the code passed in the parameter. Owner is the email address of the user that you want to assign to the deck. If the string is empty then it does not filter by user. Returns ErrNoDeck if the deck does not exist or cannot be located
func GetDeckContents ¶ added in v1.0.1
func GetDeckContents(database *server.Database, deck *deckModel.Deck) (*deckModel.DeckContents, error)
GetDeckContents - Iterates through all the boards in a deck and fetches the card models for each of the cards. First all the cardID's across all boards are appended to a single list and a single database call is consumed to fetch them down. Then they are iterated over and each board is checked for the ID, if it is found then it is added its respective board as a deckModel.DeckContentEntry structure
func IndexDecks ¶ added in v1.0.1
IndexDecks Returns all decks in the database unmarshalled as deck models. The limit parameter will be passed directly to the database query to limit the number of models returned
func NewDeck ¶
NewDeck Insert a new deck in the form of a model into the MongoDB database. The deck model must have a valid name and deck code, additionally the deck cannot already exist under the same deck code. Owner is the email address of the owner you want to assign the deck to. If the string is empty, it will be assigned to the system user
func RemoveCards ¶ added in v1.1.9
func RemoveCards(database *server.Database, deck *deckModel.Deck, contents *deckModel.DeckContentIds) error
RemoveCards - Remove cards from a specified board. Does not validate cards
Types ¶
This section is empty.