Documentation
¶
Index ¶
- func AddCards(database *server.Database, set *set.Set, newCards []string) error
- func DeleteSet(database *server.Database, code string, owner string) error
- func GetSet(database *server.Database, code string, owner string) (*set.Set, error)
- func GetSetContents(database *server.Database, set *set.Set) error
- func IndexSets(database *server.Database, limit int64) ([]*set.Set, error)
- func NewSet(database *server.Database, set *set.Set, owner string) error
- func RemoveCards(database *server.Database, set *set.Set, cards []string) error
- func ReplaceSet(database *server.Database, set *set.Set) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCards ¶ added in v1.2.7
AddCards Update the contentIds in the set model passed with new cards. This should probably perform card validation in the future. This should also be updated to allow multiples of cards to be added
func DeleteSet ¶ added in v1.2.7
DeleteSet Remove a set from the MongoDB database using the code passed in the parameter. Returns ErrNoSet if the set does not exist. Returns ErrSetDeleteFailed if the deleted count does not equal 1
func GetSet ¶
GetSet Takes a single string representing a set code and returns a set model for the set. Returns ErrNoSet if the set does not exist, or cannot be located
func GetSetContents ¶ added in v1.2.7
GetSetContents Update the contents field of the set passed in the parameter using the GetCards function. Consumes a single database call. If the contentIds field is nil or has a length of 0, it will return nil and abort the call
func IndexSets ¶
IndexSets Returns all sets in the database unmarshalled as card models. The limit parameter will be passed directly to the database query to limit the number of models returned
func NewSet ¶ added in v1.2.7
NewSet Insert a new set in the form of a model into the MongoDB database. The set model must have a valid name and set code, additionally the set cannot already exist under the same set code. Owner is the email address of the owner you want to assign the deck to. If the string is empty (i.e. == ""), it will be assigned to the system user
func RemoveCards ¶ added in v1.2.7
RemoveCards Update the contentIds in the set model with the cards to be removed in the cards array. This should be updated to support removing multiples of one card at a time
Types ¶
This section is empty.