Documentation ¶
Index ¶
Constants ¶
const ( // DialectMysql is the mysql dialect. DialectMysql = "mysql" // DialectPostgres is the postgres dialect. DialectPostgres = "postgres" )
Variables ¶
This section is empty.
Functions ¶
func EnsureMigrations ¶
EnsureMigrations checks which migrations from the given folder need to be executed It performs all missing migrations This implementation does not use an existing db instance since the lock release mechanism in "NewWithDatabaseInstance" is buggy
func MustApplyDatabaseSeed ¶
MustApplyDatabaseSeed applies all SQL queries from the given file to the currently active database. If any database table besides "schema_migrations" already contains data, the seed file will not be applied.
Types ¶
type Config ¶
type Config struct { Dialect string Host string Port string User string Password string Name string SSLMode string // optional, only used for postgres }
Config holds all configuration values for the DB setup
func (*Config) Driver ¶
Driver selects the correct DB driver and passes the connection details (DSN). It does not yet open a database connection.
func (*Config) MigrationURL ¶
MigrationURL returns a database URL with database for migrations.
type GormWriter ¶
type GormWriter struct {
observance.Logger
}
GormWriter implements the Writer interface for setting up the GORM logger.
func (GormWriter) Printf ¶
func (g GormWriter) Printf(msg string, data ...interface{})
Printf writes a log entry.