Documentation
¶
Index ¶
- func NewProvider(t *testing.T, db *sql.DB) *goose.Provider
- func Schema() *database.Schema
- func SetupDB(t *testing.T) *sql.DB
- func SetupDBFile(t *testing.T) (*sql.DB, string)
- type GameBuilder
- func (b *GameBuilder) Build() dbq.GameInstall
- func (b *GameBuilder) NotPresent() *GameBuilder
- func (b *GameBuilder) WithInstallRoot(root string) *GameBuilder
- func (b *GameBuilder) WithInstanceID(id string) *GameBuilder
- func (b *GameBuilder) WithName(name string) *GameBuilder
- func (b *GameBuilder) WithStore(storeID string) *GameBuilder
- func (b *GameBuilder) WithStoreGameID(id string) *GameBuilder
- type ProfileBuilder
- type StoreBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewProvider ¶ added in v0.8.0
NewProvider returns a goose provider for db that reads migrations from the filesystem, for tests that need to control how far a database is migrated.
func Schema ¶ added in v0.9.0
Schema is the schema of the repository: what main makes with the migrations that are embedded in the binary, which a test does not have, so it is made with the migrations in the directory that they are in. A test gives it to what migrates a database, since nothing finds one by itself.
func SetupDB ¶
SetupDB creates an in-memory SQLite database with migrations applied. The DB is closed automatically when the test completes. Apply migrations from the filesystem rather than the embedded FS which is not populated when running tests.
func SetupDBFile ¶ added in v0.9.0
SetupDBFile is SetupDB for a database in a file, which is what something that opens its database by its path needs (a database that is not in memory is one for every connection, which is what lets the code that is tested open it for itself). It returns the database, for what the test puts in it, and the path to it. The file is in a directory of the test, and the database is closed when the test completes.
Types ¶
type GameBuilder ¶
type GameBuilder struct {
// contains filtered or unexported fields
}
GameBuilder builds a game_install row, creating a store if one is not provided
func (*GameBuilder) Build ¶
func (b *GameBuilder) Build() dbq.GameInstall
func (*GameBuilder) NotPresent ¶
func (b *GameBuilder) NotPresent() *GameBuilder
func (*GameBuilder) WithInstallRoot ¶
func (b *GameBuilder) WithInstallRoot(root string) *GameBuilder
func (*GameBuilder) WithInstanceID ¶
func (b *GameBuilder) WithInstanceID(id string) *GameBuilder
func (*GameBuilder) WithName ¶
func (b *GameBuilder) WithName(name string) *GameBuilder
func (*GameBuilder) WithStore ¶
func (b *GameBuilder) WithStore(storeID string) *GameBuilder
func (*GameBuilder) WithStoreGameID ¶
func (b *GameBuilder) WithStoreGameID(id string) *GameBuilder
type ProfileBuilder ¶
type ProfileBuilder struct {
// contains filtered or unexported fields
}
ProfileBuilder builds a profile row for a game install.
func NewProfile ¶
func NewProfile(t *testing.T, db *sql.DB) *ProfileBuilder
func (*ProfileBuilder) Active ¶
func (b *ProfileBuilder) Active() *ProfileBuilder
func (*ProfileBuilder) Build ¶
func (b *ProfileBuilder) Build() dbq.Profile
func (*ProfileBuilder) WithGame ¶
func (b *ProfileBuilder) WithGame(gi dbq.GameInstall) *ProfileBuilder
func (*ProfileBuilder) WithName ¶
func (b *ProfileBuilder) WithName(name string) *ProfileBuilder
type StoreBuilder ¶
type StoreBuilder struct {
// contains filtered or unexported fields
}
StoreBuilder builds a store row
func (*StoreBuilder) Build ¶
func (b *StoreBuilder) Build() dbq.Store
func (*StoreBuilder) WithID ¶
func (b *StoreBuilder) WithID(id string) *StoreBuilder
func (*StoreBuilder) WithImplementation ¶
func (b *StoreBuilder) WithImplementation(impl string) *StoreBuilder