db

package
v0.0.0-...-7e31de2 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DB

func DB(ctx context.Context, fallback *gorm.DB) *gorm.DB

Types

type GormSession

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

func GORM

func GORM(db *gorm.DB, opt *sql.TxOptions) GormSession

func (GormSession) Begin

func (s GormSession) Begin(ctx context.Context) (Session, error)

func (GormSession) Commit

func (s GormSession) Commit() error

func (GormSession) Context

func (s GormSession) Context() context.Context

func (GormSession) Rollback

func (s GormSession) Rollback() error

func (GormSession) Transaction

func (s GormSession) Transaction(ctx context.Context, f func(context.Context) error) error

type Session

type Session interface {
	Begin(ctx context.Context) (Session, error)
	Transaction(ctx context.Context, f func(context.Context) error) error
	Rollback() error
	Commit() error
	Context() context.Context
}

Jump to

Keyboard shortcuts

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