Documentation
¶
Index ¶
- func LoadFixtures(foldername string, db *sql.DB, h DataBaseHelper) error
- type DataBaseHelper
- type FixtureFile
- type PostgreSQLHelper
- func (h *PostgreSQLHelper) AfterLoad(db *sql.DB) error
- func (h *PostgreSQLHelper) BeforeLoad(db *sql.DB) error
- func (h *PostgreSQLHelper) DisableTriggers(db *sql.DB) error
- func (h *PostgreSQLHelper) EnableTriggers(db *sql.DB) error
- func (h *PostgreSQLHelper) GetSequences(db *sql.DB) ([]string, error)
- func (h *PostgreSQLHelper) GetTables(db *sql.DB) ([]string, error)
- func (h *PostgreSQLHelper) ResetSequences(db *sql.DB) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadFixtures ¶
func LoadFixtures(foldername string, db *sql.DB, h DataBaseHelper) error
LoadFixtures loads all fixtures in a given folder in the database
Types ¶
type DataBaseHelper ¶
type DataBaseHelper interface {
DisableTriggers(db *sql.DB) error
EnableTriggers(db *sql.DB) error
BeforeLoad(db *sql.DB) error
AfterLoad(db *sql.DB) error
}
DataBaseHelper is the generic interface for the database helper
type FixtureFile ¶
FixtureFile represents a fixture file
func (*FixtureFile) Delete ¶
func (f *FixtureFile) Delete(tx *sql.Tx) error
Delete deletes all records of the table
func (*FixtureFile) FileNameWithoutExtension ¶
func (f *FixtureFile) FileNameWithoutExtension() string
FileNameWithoutExtension returns the filename without the extension e.g.: posts.yml -> posts
type PostgreSQLHelper ¶
type PostgreSQLHelper struct {
}
PostgreSQLHelper is the PG helper for this package
func (*PostgreSQLHelper) AfterLoad ¶
func (h *PostgreSQLHelper) AfterLoad(db *sql.DB) error
AfterLoad runs after the fixture load
func (*PostgreSQLHelper) BeforeLoad ¶
func (h *PostgreSQLHelper) BeforeLoad(db *sql.DB) error
BeforeLoad runs before the fixture load by now, does nothing
func (*PostgreSQLHelper) DisableTriggers ¶
func (h *PostgreSQLHelper) DisableTriggers(db *sql.DB) error
DisableTriggers disable referential integrity triggers
func (*PostgreSQLHelper) EnableTriggers ¶
func (h *PostgreSQLHelper) EnableTriggers(db *sql.DB) error
EnableTriggers enable referential integrity triggers
func (*PostgreSQLHelper) GetSequences ¶
func (h *PostgreSQLHelper) GetSequences(db *sql.DB) ([]string, error)
GetSequences get all sequences of the database
func (*PostgreSQLHelper) GetTables ¶
func (h *PostgreSQLHelper) GetTables(db *sql.DB) ([]string, error)
GetTables get all tables of the database
func (*PostgreSQLHelper) ResetSequences ¶
func (h *PostgreSQLHelper) ResetSequences(db *sql.DB) error
ResetSequences resets the sequences of "id"s columns assumes the primery key is "id" and sequence is "<tablename>_id_seq", the default when using the SERIAL column type