gorm

package
v0.1.30 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMySQL added in v0.1.4

func NewMySQL(c Config) (*gorm.DB, error)

func NewPostgreSQL added in v0.1.4

func NewPostgreSQL(c Config) (*gorm.DB, error)

Types

type Config

type Config struct {
	DSN    string
	Logger Logger
}

type CustomLogger

type CustomLogger struct {
	// contains filtered or unexported fields
}

func NewCustomLogger

func NewCustomLogger(logger *xlogger.Logger) *CustomLogger

func (*CustomLogger) Error

func (l *CustomLogger) Error(ctx context.Context, msg string, data ...any)

func (*CustomLogger) Info

func (l *CustomLogger) Info(ctx context.Context, msg string, data ...any)

func (*CustomLogger) LogMode

func (l *CustomLogger) LogMode(lev logger.LogLevel) logger.Interface

func (*CustomLogger) Trace

func (l *CustomLogger) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error)

func (*CustomLogger) Warn

func (l *CustomLogger) Warn(ctx context.Context, msg string, data ...any)

type DB added in v0.1.4

type DB = gorm.DB

type Logger

type Logger = logger.Interface

type Model added in v0.1.5

type Model = gorm.Model

type Tx added in v0.1.14

type Tx struct {
	// contains filtered or unexported fields
}

func NewTx added in v0.1.14

func NewTx(db *gorm.DB) *Tx

func (*Tx) Exec added in v0.1.14

func (t *Tx) Exec(ctx context.Context, fn func(ctx context.Context) error) error

Execute a transaction.

func (*Tx) GetTx added in v0.1.14

func (t *Tx) GetTx(ctx context.Context) *gorm.DB

Get the transaction from the context. If not found, return the original database.

Jump to

Keyboard shortcuts

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