set

package
v1.4.9 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: Unlicense Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCards added in v1.2.7

func AddCards(database *server.Database, set *set.Set, newCards []string) error

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

func DeleteSet(database *server.Database, code string, owner string) error

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

func GetSet(database *server.Database, code string, owner string) (*set.Set, error)

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

func GetSetContents(database *server.Database, set *set.Set) error

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

func IndexSets(database *server.Database, limit int64) ([]*set.Set, error)

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

func NewSet(database *server.Database, set *set.Set, owner string) error

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

func RemoveCards(database *server.Database, set *set.Set, cards []string) error

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

func ReplaceSet added in v1.2.7

func ReplaceSet(database *server.Database, set *set.Set) error

ReplaceSet Replace the entire set in the database with the model passed in the parameter. Returns ErrSetUpdateFailed if the set cannot be located

Types

This section is empty.

Jump to

Keyboard shortcuts

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