Documentation ¶
Index ¶
- func CardByMTGJsonID(dbh *Handle, id string) (*mtgjson.Card, error)
- func CardByName(dbh *Handle, name string) (*mtgjson.Card, error)
- func SaveCards(db *Handle, sets map[string]mtgjson.Set) error
- func SchemaMigrations() []*gomigrate.Migration
- func SearchCards(db *Handle, columns []string, values [][]string) ([]mtgjson.Card, error)
- type Handle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CardByMTGJsonID ¶
CardByMTGJsonID returns the first card found with the given mtgjson.com id
func CardByName ¶
CardByName returns the most recent version of a card with the exact given name
func SchemaMigrations ¶
SchemaMigrations gives each caller a new copy of the migrations. This is mostly useful to allow unit tests to run in parallel.
Types ¶
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
Handle controls access to the database and makes sure only one operation is in process at a time.
func NewDBHandle ¶
func NewDBHandle(dbPath string, verbose bool, logger logrus.FieldLogger) *Handle
NewDBHandle creates a new DBHandle
dbPath: the path to the database to use. verbose: when true database accesses are logged to stdout
func NewMemoryDBHandle ¶
func NewMemoryDBHandle(verbose bool, logger logrus.FieldLogger, loadFixtures bool) *Handle
NewMemoryDBHandle creates a new in memory database. Only used for testing. The name of the database is a random string so multiple tests can run in parallel with their own database.
Click to show internal directories.
Click to hide internal directories.