db

package
v0.0.0-...-74a5c12 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: MIT Imports: 6 Imported by: 6

Documentation

Index

Constants

View Source
const (
	MysqlType    = 1
	PostgresType = 2

	TxContext = "db tx context"
)

Variables

This section is empty.

Functions

func NewMysqlEngine

func NewMysqlEngine(dbConfig DbConfig) (*gorm.DB, error)

func NewPostgresEngine

func NewPostgresEngine(dbConfig DbConfig) (*gorm.DB, error)

func SetupDBEngine

func SetupDBEngine(cfg DbConfig)

SetupDBEngine init call

Types

type DbConfig

type DbConfig struct {
	DbType    int
	DbName    string
	Host      string
	Port      string
	Username  string
	Pwd       string
	Charset   string
	ParseTime bool
}

DbConfig ...

type WarpDB

type WarpDB struct {
	*gorm.DB
}
var DBEngine WarpDB

dbEngine global def

func (WarpDB) WithContext

func (db WarpDB) WithContext(ctx context.Context) *gorm.DB

Jump to

Keyboard shortcuts

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