database

package
Version: v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2016 License: MPL-2.0 Imports: 11 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTestDatabase

func CreateTestDatabase(dbPath string, migrationFunctions []func(*gorm.DB) error, fixtureFiles []string) (*gorm.DB, error)

CreateTestDatabase recreates the test database and runs migrations and fixtures as passed in, returning a pointer to the database

func CreateTestDatabasePostgres

func CreateTestDatabasePostgres(dbUser, dbName string, migrationFunctions []func(*gorm.DB) error, fixtureFiles []string) (*gorm.DB, error)

CreateTestDatabasePostgres is similar to CreateTestDatabase but it uses Postgres instead of sqlite, this is needed for testing packages that rely on some Postgres specifuc features (such as table inheritance)

func NewDatabase

func NewDatabase(cnf *config.Config) (*gorm.DB, error)

NewDatabase returns a gorm.DB struct, gorm.DB.DB() returns a database handle see http://golang.org/pkg/database/sql/#DB

Types

type TimestampModel

type TimestampModel struct {
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time
}

TimestampModel ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL