Versions in this module Expand all Collapse all v1 v1.0.1 Feb 21, 2024 v1.0.0 Feb 21, 2024 Changes in this version + const PgDuplicatedForeignKey + const PgDuplicatedKey + const PqDbAlreadyExistsCode + const PqInvalidDBCode + func CreatePostgresDbIfNotExists(ctx context.Context, gormConfig *gorm.Config, pgConfig PostgresConfig) (*gorm.DB, error) + func GetDB(ctx context.Context, dbConfig *DbConfig, logConfig *logger.Config) (*gorm.DB, error) + func GetGormLogger(ctx context.Context, logConfig *logger.Config) gormLogger.Interface + func IsPgErrorWithCode(err error, code string) bool + func Migrate(ctx context.Context, databaseConfig *DbConfig, ...) error + func Rollback(ctx context.Context, databaseConfig *DbConfig, ...) error + type DbConfig struct + ConnMaxLifeTime config.Duration + DeprecatedDbName string + DeprecatedDebug bool + DeprecatedExtraOptions string + DeprecatedHost string + DeprecatedPassword string + DeprecatedPasswordPath string + DeprecatedPort int + DeprecatedUser string + EnableForeignKeyConstraintWhenMigrating bool + MaxIdleConnections int + MaxOpenConnections int + Postgres PostgresConfig + SQLite SQLiteConfig + func GetConfig() *DbConfig + func (cfg DbConfig) GetPFlagSet(prefix string) *pflag.FlagSet + type PostgresConfig struct + DbName string + Debug bool + ExtraOptions string + Host string + Password string + PasswordPath string + Port int + User string + func (s PostgresConfig) IsEmpty() bool + type SQLiteConfig struct + File string + func (s SQLiteConfig) IsEmpty() bool