Versions in this module Expand all Collapse all v1 v1.0.0 May 11, 2024 Changes in this version + func FileWithLineNum() string + func MustNewDB(c Config) *gorm.DB + func MustNewDBMock(c Config) (*gorm.DB, sqlmock.Sqlmock) + func NewDB(c Config) (*gorm.DB, error) + func NewDBMock(c Config) (*gorm.DB, sqlmock.Sqlmock, error) + type Config struct + ConnMaxIdleTime time.Duration + ConnMaxLifeTime time.Duration + Database string + Host string + LogLevel LogLevel + MaxIdleConns int + MaxOpenConns int + NeedCreate bool + Params string + Password string + Port int + SlowThreshold time.Duration + Type Type + User string + func (c Config) GetGORMConfig() *gorm.Config + func (c Config) GetMySQLConfig(needDatabase ...bool) mysql.Config + func (c Config) GetPostgreSQLConfig(needDatabase ...bool) postgres.Config + func (c Config) GetSQLServerConfig(needDatabase ...bool) sqlserver.Config + func (c Config) GetSQLiteDSN() string + type LogLevel string + const Error + const Info + const Silent + const Warn + func (l LogLevel) ToGROMLogLevel() (logLevel logger.LogLevel) + type Logger struct + LogLevel logger.LogLevel + SlowThreshold time.Duration + func NewLogger(logLevel logger.LogLevel, slowThreshold time.Duration) *Logger + func (l *Logger) Error(ctx context.Context, msg string, data ...any) + func (l *Logger) Info(ctx context.Context, msg string, data ...any) + func (l *Logger) LogMode(level logger.LogLevel) logger.Interface + func (l *Logger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error) + func (l *Logger) Warn(ctx context.Context, msg string, data ...any) + type Type string + const MySQL + const PostgreSQL + const SQLServer + const SQLite + func (t Type) CheckDB(db *gorm.DB) error + func (t Type) CreateDB(db *gorm.DB, database string) error + func (t Type) GetCheckSQL() (checkSQL string) + func (t Type) GetCreateSQL(database string) (createSQL string) + func (t Type) GetVersionSQL() (versionSQL string) + func (t Type) VersionDB(db *gorm.DB) (string, error)