db

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2022 License: GPL-3.0 Imports: 11 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(config_ Config) *gorm.DB

func NewGormLogger

func NewGormLogger(zap *zap.SugaredLogger, databaseLoggerConfig LoggerConfig) gormLogger.Interface

Types

type AutoMigrater

type AutoMigrater interface {
	AutoMigrate()
}

type Config

type Config struct {
	IsAutoMigrate bool   `env:"IS_AUTO_MIGRATE" envDefault:"true"`
	PgsqlUri      string `env:"PGSQL_URI"`
	PgsqlMaxIdle  int    `env:"PGSQL_MAX_IDLE" envDefault:"50"`
	PgsqlMaxOpen  int    `env:"PGSQL_MAX_OPEN" envDefault:"50"`
}

type LoggerConfig

type LoggerConfig struct {
	LogLevel                  gormLogger.LogLevel
	SlowThreshold             time.Duration
	IgnoreRecordNotFoundError bool
}

func NewDevelopmentGormLoggerConfig

func NewDevelopmentGormLoggerConfig() LoggerConfig

func NewProductionGormLoggerConfig

func NewProductionGormLoggerConfig() LoggerConfig

func (LoggerConfig) BuildWith

func (loggerConfig LoggerConfig) BuildWith(zap *zap.SugaredLogger) gormLogger.Interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL