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) ConnectionString ¶
ConnectionString returns a valid string for sql.Open.
func (*Config) MigrationURL ¶
MigrationURL returns a database URL with database for migrations.
type GormLogrus ¶
type GormLogrus struct {
observance.Logger
}
GormLogrus is a logrus logger that implements the gorm interface for logging.
func (GormLogrus) Print ¶
func (g GormLogrus) Print(v ...interface{})
Print implements the gorm.LogWriter interface, courtesy of https://gist.github.com/bnadland/2e4287b801a47dcfcc94.