datasource

package
v2.0.15 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 10 Imported by: 4

Documentation

Index

Constants

View Source
const (
	AppName = "datasource"
)

Variables

This section is empty.

Functions

func BeginTransaction added in v2.0.2

func BeginTransaction(ctx context.Context) *gorm.DB

开启事务

func DB

func DB() *gorm.DB

func DBFromCtx added in v2.0.3

func DBFromCtx(ctx context.Context) *gorm.DB

从上下文中获取事物, 如果获取不到则直接返回 无事物的DB对象

func EndTransaction

func EndTransaction(tx *gorm.DB, err error) error

结束事务

func Get added in v2.0.8

func Get() *dataSource

func GetTransactionFromCtx

func GetTransactionFromCtx(ctx context.Context) *gorm.DB

func WithTransactionCtx

func WithTransactionCtx(ctx context.Context, tx *gorm.DB) context.Context

Types

type PROVIDER

type PROVIDER string
const (
	PROVIDER_MYSQL PROVIDER = "mysql"
)

type TransactionCtxKey

type TransactionCtxKey struct{}

Jump to

Keyboard shortcuts

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