testfixtures.v1: gopkg.in/testfixtures.v1 Index | Files

package testfixtures

import "gopkg.in/testfixtures.v1"


Package Files

database_helper.go mysql_helper.go options.go oracle_helper.go postgresql_helper.go sqlite_helper.go sqlserver_helper.go testfixtures.go time.go


var (
    // ErrWrongCastNotAMap is returned when a map is not a map[interface{}]interface{}
    ErrWrongCastNotAMap = fmt.Errorf("Could not cast record: not a map[interface{}]interface{}")

    // ErrFileIsNotSliceOrMap is returned the the fixture file is not a slice or map.
    ErrFileIsNotSliceOrMap = fmt.Errorf("The fixture file is not a slice or map")

    // ErrKeyIsNotString is returned when a record is not of type string
    ErrKeyIsNotString = fmt.Errorf("Record map key is not string")

func LoadFixtureFiles Uses

func LoadFixtureFiles(db *sql.DB, h DataBaseHelper, files ...string) error

LoadFixtureFiles load all specified fixtures files into database:

LoadFixtureFiles(db, &PostgreSQLHelper{},
	"fixtures/customers.yml", "fixtures/orders.yml")
	// add as many files you want

func LoadFixtures Uses

func LoadFixtures(foldername string, db *sql.DB, h DataBaseHelper) error

LoadFixtures loads all fixtures in a given folder into the database:

LoadFixtures("myfixturesfolder", db, &PostgreSQLHelper{})

func ResetSequencesTo Uses

func ResetSequencesTo(value int64)

ResetSequencesTo sets the value the sequences will be reset to. This is used by PostgreSQL and Oracle. Defaults to 10000.

func SkipDatabaseNameCheck Uses

func SkipDatabaseNameCheck(value bool)

SkipDatabaseNameCheck If true, loading fixtures will not check if the database name constaint "test". Use with caution!

type DataBaseHelper Uses

type DataBaseHelper interface {
    // contains filtered or unexported methods

DataBaseHelper is the generic interface for the database helper

type MySQLHelper Uses

type MySQLHelper struct{}

MySQLHelper is the MySQL helper for this package

type OracleHelper Uses

type OracleHelper struct{}

OracleHelper is the Oracle database helper for this package

type PostgreSQLHelper Uses

type PostgreSQLHelper struct {
    // UseAlterConstraint If true, the contraint disabling will do
    // using ALTER CONTRAINT sintax, only allowed in PG >= 9.4.
    // If false, the constraint disabling will use DISABLE TRIGGER ALL,
    // which requires SUPERUSER privileges.
    UseAlterConstraint bool

PostgreSQLHelper is the PG helper for this package

type SQLServerHelper Uses

type SQLServerHelper struct{}

SQLServerHelper is the helper for SQL Server for this package. SQL Server >= 2008 is required.

type SQLiteHelper Uses

type SQLiteHelper struct{}

SQLiteHelper is the SQLite Helper for this package

Package testfixtures imports 10 packages (graph). Updated 2018-02-25. Refresh now. Tools for package owners.