repo

package
v0.0.0-...-da2935b Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCreateZeroRowsAffected 插入0行数据
	ErrCreateZeroRowsAffected = errors.New("ErrCreateZeroRowsAffected")
	// ErrUpdateZeroRowsAffected 更新0行数据
	ErrUpdateZeroRowsAffected = errors.New("ErrUpdateZeroRowsAffected")
	// ErrDeleteZeroRowsAffected 删除0行数据
	ErrDeleteZeroRowsAffected = errors.New("ErrDeleteZeroRowsAffected")
	// ErrObjectNotExist 对象不存在
	ErrObjectNotExist = errors.New("ErrObjectNotExist")
)

Functions

This section is empty.

Types

type DB

type DB interface {
	DB() (*sql.DB, error)

	AutoMigrate(dst ...interface{}) (err error)
	WithContext(ctx context.Context) DB

	// Exec execute raw sql
	Exec(sql string, values ...interface{}) (rowsAffected int64, err error)

	First(dest interface{}, conds ...interface{}) (err error)
	Create(value interface{}) (rowsAffected int64, err error)
	Update(value interface{}) (rowsAffected int64, err error)
	Delete(value interface{}) (rowsAffected int64, err error)
	Raw(dest interface{}, sql string, values ...interface{}) (rowsAffected int64, err error)
	Transaction(fc func(tx DB) error, opts ...*sql.TxOptions) error

	Where(query interface{}, args ...interface{}) (tx DB)
	Find(dest interface{}, conds ...interface{}) (err error)
	Order(value interface{}) (tx DB)
	Limit(limit int) (tx DB)
	Offset(offset int) (tx DB)

	Close() error
}

Jump to

Keyboard shortcuts

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