datasource

package
v2.0.44 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 12 Imported by: 12

Documentation

Index

Constants

View Source
const (
	AppName = "datasource"
)

Variables

This section is empty.

Functions

func DB

func DB() *gorm.DB

func DBFromCtx added in v2.0.3

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

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

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"
	PROVIDER_POSTGRES PROVIDER = "postgres"
	PROVIDER_SQLITE   PROVIDER = "sqlite"
)

type TransactionCtxKey

type TransactionCtxKey struct{}

Jump to

Keyboard shortcuts

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