mysql

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQL

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

func NewMySQL

func NewMySQL(opt Option, logger log.Logger) (*MySQL, func(), error)

NewMySQL .

func (*MySQL) DB

func (d *MySQL) DB(ctx context.Context) *gorm.DB

DB 根据此方法来判断当前的 db 是不是使用 事务的 DB

func (*MySQL) ExecTx

func (d *MySQL) ExecTx(ctx context.Context, fn func(ctx context.Context) error) error

ExecTx gorm Transaction

type Option

type Option interface {
	GetDebug() bool
	GetDriver() string
	GetSource() string
}

type Transaction

type Transaction interface {
	ExecTx(context.Context, func(ctx context.Context) error) error
}

type Transactor

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

func (*Transactor) ExecTx

func (t *Transactor) ExecTx(ctx context.Context, fn func(ctx context.Context) error) error

ExecTx gorm Transaction

Jump to

Keyboard shortcuts

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