Documentation ¶
Overview ¶
*
- @Author : nopsky
- @Email : cnnopsky@gmail.com
- @Date : 2021/4/2 13:47
*
- @Author : nopsky
- @Email : cnnopsky@gmail.com
- @Date : 2021/3/11 15:25
*
- @Author : nopsky
- @Email : cnnopsky@gmail.com
- @Date : 2021/3/11 15:26
*
- @Author : nopsky
- @Email : cnnopsky@gmail.com
- @Date : 2021/6/26 16:56
*
- @Author : nopsky
- @Email : cnnopsky@gmail.com
- @Date : 2021/3/18 14:03
*
- @Author : nopsky
- @Email : cnnopsky@gmail.com
- @Date : 2021/3/11 15:26
*
- @Author : nopsky
- @Email : cnnopsky@gmail.com
- @Date : 2021/3/11 15:26
*
- @Author : nopsky
- @Email : cnnopsky@gmail.com
- @Date : 2021/3/11 17:14
Index ¶
- Variables
- func InitMySQL()
- func Transaction(ctx context.Context, fn funcType, opts ...*sql.TxOptions) (resp interface{}, err error)
- type DB
- func (db *DB) AutoMigrate(value interface{}) error
- func (db *DB) Begin(opts ...*sql.TxOptions) *DB
- func (db *DB) Commit() *DB
- func (db *DB) Count(count *int64) *DB
- func (db *DB) Create(value interface{}) (tx *DB)
- func (db *DB) Delete(value interface{}, conds ...interface{}) *DB
- func (db *DB) Distinct(args ...interface{}) *DB
- func (db *DB) Error() error
- func (db *DB) Exec(sql string, values ...interface{}) *DB
- func (db *DB) Find(dest interface{}, conds ...interface{}) *DB
- func (db *DB) First(dest interface{}, conds ...interface{}) *DB
- func (db *DB) FirstOrCreate(dest interface{}, conds ...interface{}) *DB
- func (db *DB) GroupBy(name string) *DB
- func (db *DB) Having(query interface{}, args ...interface{}) *DB
- func (db *DB) Joins(query string, args ...interface{}) *DB
- func (db *DB) Last(dest interface{}, conds ...interface{}) *DB
- func (db *DB) Limit(limit int) *DB
- func (db *DB) Model(value interface{}) *DB
- func (db *DB) Not(query interface{}, args ...interface{}) *DB
- func (db *DB) Offset(offset int) *DB
- func (db *DB) Omit(columns ...string) *DB
- func (db *DB) Or(query interface{}, args ...interface{}) *DB
- func (db *DB) OrderBy(value interface{}) *DB
- func (db *DB) Pluck(column string, dest interface{}) *DB
- func (db *DB) Raw(sql string, values ...interface{}) *DB
- func (db *DB) Rollback() *DB
- func (db *DB) RowsAffected() int64
- func (db *DB) Save(value interface{}) (tx *DB)
- func (db *DB) Scopes(funcs ...func(*DB) *DB) *DB
- func (db *DB) Select(query interface{}, args ...interface{}) *DB
- func (db *DB) Table(name string, args ...interface{}) *DB
- func (db *DB) Take(dest interface{}, conds ...interface{}) *DB
- func (db *DB) Update(column string, value interface{}) *DB
- func (db *DB) UpdateColumn(column string, value interface{}) *DB
- func (db *DB) UpdateColumns(values interface{}) *DB
- func (db *DB) Updates(values interface{}) *DB
- func (db *DB) Where(query interface{}, args ...interface{}) *DB
- type Options
- type TxContext
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrRecordNotFound record not found error ErrRecordNotFound = errors.New("not found") // ErrInvalidTransaction invalid transaction when you are trying to `Commit` or `Rollback` ErrInvalidTransaction = errors.New("invalid transaction") // ErrNotImplemented not implemented ErrNotImplemented = errors.New("not implemented") // ErrMissingWhereClause missing where clause ErrMissingWhereClause = errors.New("WHERE conditions required") // ErrUnsupportedRelation unsupported relations ErrUnsupportedRelation = errors.New("unsupported relations") // ErrPrimaryKeyRequired primary keys required ErrPrimaryKeyRequired = errors.New("primary key required") // ErrModelValueRequired model value required ErrModelValueRequired = errors.New("model value required") // ErrInvalidData unsupported data ErrInvalidData = errors.New("unsupported data") // ErrUnsupportedDriver unsupported driver ErrUnsupportedDriver = errors.New("unsupported driver") // ErrRegistered registered ErrRegistered = errors.New("registered") // ErrInvalidField invalid field ErrInvalidField = errors.New("invalid field") // ErrEmptySlice empty slice found ErrEmptySlice = errors.New("empty slice found") // ErrDryRunModeUnsupported dry run mode unsupported ErrDryRunModeUnsupported = errors.New("dry run mode unsupported") // ErrInvalidDB invalid db ErrInvalidDB = errors.New("invalid db") // ErrInvalidValue invalid value ErrInvalidValue = errors.New("invalid value, should be pointer to struct or slice") // ErrInvalidValueOfLength invalid values do not match length ErrInvalidValueOfLength = errors.New("invalid association values, length doesn't match") )
Functions ¶
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) AutoMigrate ¶ added in v0.0.24
func (*DB) FirstOrCreate ¶
func (*DB) RowsAffected ¶
func (*DB) UpdateColumn ¶
func (*DB) UpdateColumns ¶
Click to show internal directories.
Click to hide internal directories.