0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-19 04:44:21 +01:00
gitea/vendor/gopkg.in/testfixtures.v2/deprecated.go
2016-12-31 10:17:45 +01:00

59 lines
1.5 KiB
Go

package testfixtures
import (
"database/sql"
)
type (
DataBaseHelper Helper // Deprecated: Use Helper instead
PostgreSQLHelper struct { // Deprecated: Use PostgreSQL{} instead
PostgreSQL
UseAlterConstraint bool
}
MySQLHelper struct { // Deprecated: Use MySQL{} instead
MySQL
}
SQLiteHelper struct { // Deprecated: Use SQLite{} instead
SQLite
}
SQLServerHelper struct { // Deprecated: Use SQLServer{} instead
SQLServer
}
OracleHelper struct { // Deprecated: Use Oracle{} instead
Oracle
}
)
func (h *PostgreSQLHelper) disableReferentialIntegrity(db *sql.DB, loadFn loadFunction) error {
h.PostgreSQL.UseAlterConstraint = h.UseAlterConstraint
return h.PostgreSQL.disableReferentialIntegrity(db, loadFn)
}
// LoadFixtureFiles load all specified fixtures files into database:
// LoadFixtureFiles(db, &PostgreSQL{},
// "fixtures/customers.yml", "fixtures/orders.yml")
// // add as many files you want
//
// Deprecated: Use NewFiles() and Load() instead.
func LoadFixtureFiles(db *sql.DB, helper Helper, files ...string) error {
c, err := NewFiles(db, helper, files...)
if err != nil {
return err
}
return c.Load()
}
// LoadFixtures loads all fixtures in a given folder into the database:
// LoadFixtures("myfixturesfolder", db, &PostgreSQL{})
//
// Deprecated: Use NewFolder() and Load() instead.
func LoadFixtures(folderName string, db *sql.DB, helper Helper) error {
c, err := NewFolder(db, helper, folderName)
if err != nil {
return err
}
return c.Load()
}