Documentation ¶
Index ¶
- func NewBoltSession() repository.DbSession
- type BoltSession
- func (this *BoltSession) Begin()
- func (this *BoltSession) Close()
- func (this *BoltSession) Commit()
- func (this *BoltSession) Complex(qb *repository.QueryBuilder, dest []interface{})
- func (this *BoltSession) Count(bean interface{}, conds string, params ...interface{}) int64
- func (this *BoltSession) Delete(md interface{}, conds string, params ...interface{}) int64
- func (this *BoltSession) Exec(clause string, params ...interface{}) sql.Result
- 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
- func (this *BoltSession) Insert(mds ...interface{}) int64
- func (this *BoltSession) Query(clause string, params ...interface{}) []map[string][]byte
- func (this *BoltSession) Rollback()
- func (this *BoltSession) Scan(dest interface{}) *BoltSession
- func (this *BoltSession) Sync(bean ...interface{})
- func (this *BoltSession) Transaction(fc func(s repository.DbSession) error)
- func (this *BoltSession) Update(md interface{}, columns []string, conds string, params ...interface{}) int64
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()
func (*BoltSession) Close ¶
func (this *BoltSession) Close()
func (*BoltSession) Commit ¶
func (this *BoltSession) Commit()
func (*BoltSession) Complex ¶
func (this *BoltSession) Complex(qb *repository.QueryBuilder, dest []interface{})
func (*BoltSession) Count ¶
func (this *BoltSession) Count(bean interface{}, conds string, params ...interface{}) int64
func (*BoltSession) Delete ¶
func (this *BoltSession) Delete(md interface{}, conds string, params ...interface{}) int64
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
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
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
insert model data to database
func (*BoltSession) Query ¶
func (this *BoltSession) Query(clause string, params ...interface{}) []map[string][]byte
execute sql and get result
func (*BoltSession) Rollback ¶
func (this *BoltSession) Rollback()
func (*BoltSession) Sync ¶
func (this *BoltSession) Sync(bean ...interface{})
func (*BoltSession) Transaction ¶
func (this *BoltSession) Transaction(fc func(s repository.DbSession) 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.