database

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGormLogLevel

func GetGormLogLevel(level LogLevel) logger.LogLevel

func New

func New(config Config) *gorm.DB

func NewMySqlDatabase

func NewMySqlDatabase(config Config, gConfig *gorm.Config) *gorm.DB

func NewPgSqlDatabase

func NewPgSqlDatabase(config Config, gConfig *gorm.Config) *gorm.DB

func NewSqliteDatabase

func NewSqliteDatabase(config Config, gConfig *gorm.Config) *gorm.DB

Types

type Config

type Config struct {
	Driver          Driver
	Username        string
	Password        string
	Host            string
	Port            string
	Database        string
	MaxOpenConns    int
	MaxIdleConns    int
	ConnMaxLifetime time.Duration
	LogLevel        LogLevel
}

type Driver

type Driver string
const (
	MySql  Driver = "mysql"
	PgSql  Driver = "pgsql"
	Sqlite Driver = "sqlite"
)

func GetDriver

func GetDriver(driver Driver) Driver

type LogLevel

type LogLevel string
const (
	Info   LogLevel = "info"
	Warn   LogLevel = "warn"
	Error  LogLevel = "error"
	Silent LogLevel = "silent"
)

Jump to

Keyboard shortcuts

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