Documentation ¶
Index ¶
- func NewBoltSession() repository.DbSession
- type BoltSession
- func (this *BoltSession) Begin() error
- func (this *BoltSession) Close() error
- func (this *BoltSession) Commit() error
- func (this *BoltSession) Complex(qb *repository.QueryBuilder, dest []interface{}) error
- func (this *BoltSession) Count(bean interface{}, conds string, params ...interface{}) (int64, error)
- func (this *BoltSession) Delete(md interface{}, conds string, params ...interface{}) (int64, error)
- func (this *BoltSession) Exec(clause string, params ...interface{}) (sql.Result, error)
- func (this *BoltSession) Find(rowsSlicePtr interface{}, md interface{}, orderby string, from int, limit int, ...) error
- func (this *BoltSession) Get(dest interface{}, locked bool, orderby string, conds string, ...) (bool, error)
- func (this *BoltSession) Insert(mds ...interface{}) (int64, error)
- func (this *BoltSession) Query(clause string, params ...interface{}) ([]map[string][]byte, error)
- func (this *BoltSession) Rollback() error
- func (this *BoltSession) Scan(dest interface{}) (*BoltSession, error)
- func (this *BoltSession) Sync(bean ...interface{}) error
- func (this *BoltSession) Transaction(fc func(s repository.DbSession) error) error
- func (this *BoltSession) Update(md interface{}, columns []string, conds string, params ...interface{}) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBoltSession ¶
func NewBoltSession() repository.DbSession
Types ¶
type BoltSession ¶
type BoltSession struct {
// contains filtered or unexported fields
}
每次事务开始时创建新会话
func (*BoltSession) Begin ¶
func (this *BoltSession) Begin() error
func (*BoltSession) Close ¶
func (this *BoltSession) Close() error
func (*BoltSession) Commit ¶
func (this *BoltSession) Commit() error
func (*BoltSession) Complex ¶
func (this *BoltSession) Complex(qb *repository.QueryBuilder, dest []interface{}) error
func (*BoltSession) Count ¶
func (this *BoltSession) Count(bean interface{}, conds string, params ...interface{}) (int64, error)
func (*BoltSession) Delete ¶
func (this *BoltSession) Delete(md interface{}, conds string, params ...interface{}) (int64, error)
delete model in database Delete records, bean's non-empty fields are conditions
func (*BoltSession) Exec ¶
func (this *BoltSession) Exec(clause string, params ...interface{}) (sql.Result, error)
execute sql and get result
func (*BoltSession) Find ¶
func (this *BoltSession) Find(rowsSlicePtr interface{}, md interface{}, orderby string, from int, limit int, conds string, params ...interface{}) error
Find retrieve records from table, condiBeans's non-empty fields are conditions. beans could be []Struct, []*Struct, map[int64]Struct map[int64]*Struct everyone := make([]Userinfo, 0) err := engine.Find(&everyone)
func (*BoltSession) Get ¶
func (this *BoltSession) Get(dest interface{}, locked bool, orderby string, conds string, params ...interface{}) (bool, error)
Get retrieve one record from database, bean's non-empty fields will be as conditions
func (*BoltSession) Insert ¶
func (this *BoltSession) Insert(mds ...interface{}) (int64, error)
insert model data to database
func (*BoltSession) Query ¶
func (this *BoltSession) Query(clause string, params ...interface{}) ([]map[string][]byte, error)
execute sql and get result
func (*BoltSession) Rollback ¶
func (this *BoltSession) Rollback() error
func (*BoltSession) Scan ¶
func (this *BoltSession) Scan(dest interface{}) (*BoltSession, error)
scan result
func (*BoltSession) Sync ¶
func (this *BoltSession) Sync(bean ...interface{}) error
func (*BoltSession) Transaction ¶
func (this *BoltSession) Transaction(fc func(s repository.DbSession) error) error
*
Transaction 的 f 参数类型为 一个在事务内处理的函数 因此可以将 f 函数作为参数传入 Transaction 函数中。 return Transaction(func(s *XormSession) error { if _,error := session.Insert(User{ID:5,Version:"abc"}); error != nil{ return error } })
Click to show internal directories.
Click to hide internal directories.