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 }
Click to show internal directories.
Click to hide internal directories.