db

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

func NewDB

func NewDB(cli *gorm.DB) *DB

func (*DB) AutoMigrate

func (db *DB) AutoMigrate(models ...any) error

func (*DB) Begin added in v0.8.2

func (db *DB) Begin(ctx context.Context) *gorm.DB

func (*DB) Client added in v0.8.2

func (db *DB) Client() *gorm.DB

func (*DB) Create

func (db *DB) Create(ctx context.Context, value any, clauses []clause.Expression) *gorm.DB

func (*DB) Delete

func (db *DB) Delete(ctx context.Context, value any, clauses []clause.Expression) *gorm.DB

func (*DB) Exec

func (db *DB) Exec(ctx context.Context, sql string, clauses []clause.Expression, values ...any) *gorm.DB

func (*DB) First

func (db *DB) First(ctx context.Context, dest any, conds ...any) *gorm.DB

func (*DB) Raw

func (db *DB) Raw(ctx context.Context, sql string, clauses []clause.Expression, values ...any) *gorm.DB

func (*DB) Save

func (db *DB) Save(ctx context.Context, value any, clauses []clause.Expression) *gorm.DB

func (*DB) Transaction added in v0.11.1

func (db *DB) Transaction(ctx context.Context, fn func(*DB) error) error

Transaction runs fn with a DB wrapper bound to one GORM transaction. Every helper called on the callback value uses that transaction rather than the root connection. The transaction commits when fn returns nil and rolls back otherwise.

Jump to

Keyboard shortcuts

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