Documentation ¶
Overview ¶
package must wraps the rdb database interface with one that returns errors with a panic.
Index ¶
- func Config(config *rdb.Config, err error) *rdb.Config
- func Run(f func(r Roller) error) (err error)
- type ConnPool
- func (must ConnPool) Begin() Transaction
- func (must ConnPool) BeginLevel(level rdb.IsolationLevel) Transaction
- func (must ConnPool) Close()
- func (must ConnPool) ConnectionInfo() *rdb.ConnectionInfo
- func (must ConnPool) Normal() *rdb.ConnPool
- func (must ConnPool) Ping()
- func (must ConnPool) PoolAvailable() (capacity, available int)
- func (must ConnPool) Query(cmd *rdb.Command, params ...rdb.Param) Result
- type Error
- type Result
- func (must Result) Close()
- func (must Result) Get(name string) interface{}
- func (must Result) GetN(name string) rdb.Nullable
- func (must Result) GetRowN() []rdb.Nullable
- func (must Result) Getx(index int) interface{}
- func (must Result) GetxN(index int) rdb.Nullable
- func (must Result) Info() []*rdb.Message
- func (must Result) Next() (more bool)
- func (must Result) NextResult() (more bool)
- func (must Result) Normal() *rdb.Result
- func (must Result) Prep(name string, value interface{}) Result
- func (must Result) Prepx(index int, value interface{}) Result
- func (r *Result) RowsAffected() uint64
- func (must Result) Scan(values ...interface{}) Result
- func (must Result) Schema() []*rdb.Column
- type Roller
- type Transaction
- func (must Transaction) Active() bool
- func (must Transaction) Commit()
- func (must Transaction) Normal() *rdb.Transaction
- func (must Transaction) Query(cmd *rdb.Command, params ...rdb.Param) Result
- func (must Transaction) Rollback()
- func (must Transaction) RollbackTo(savepoint string)
- func (must Transaction) SavePoint(name string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
A method to take many panicing members and return a normal error. The Roller function will rollback to an existing savepoint if it has not already been commited. An empty savepoint parameter to Roller will roll the transaction back entirely.
func ExampleRun() error { return rdb.Run(func(r rdb.Roller) error { db := rdb.OpenMust(config) t := db.Begin() r(t, "") t.Query(cmd1) t.SavePoint("Foo") r(t, "Foo") t.Query(cmd2) t.Commit() return nil }) }
Types ¶
type ConnPool ¶
type ConnPool struct {
// contains filtered or unexported fields
}
func NewConnPool ¶
Get the panic'ing version that doesn't return errors.
func (ConnPool) Begin ¶
func (must ConnPool) Begin() Transaction
Same as Query but will panic on an error.
func (ConnPool) BeginLevel ¶
func (must ConnPool) BeginLevel(level rdb.IsolationLevel) Transaction
Same as Query but will panic on an error.
func (ConnPool) ConnectionInfo ¶
func (must ConnPool) ConnectionInfo() *rdb.ConnectionInfo
func (ConnPool) PoolAvailable ¶
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
func (Result) Get ¶
Use after Scan(). Can only pull fields which have not already been sent into a prepared value.
func (Result) GetN ¶
Use after Scan(). Can only pull fields which have not already been sent into a prepared value.
func (Result) GetRowN ¶
Use after Scan(). Can only pull fields which have not already been sent into a prepared value. Not all fields will be populated if some have been prepared.
func (Result) Getx ¶
Use after Scan(). Can only pull fields which have not already been sent into a prepared value.
func (Result) GetxN ¶
Use after Scan(). Can only pull fields which have not already been sent into a prepared value.
func (Result) NextResult ¶
func (Result) Prep ¶
Prepare pointers to values to be populated by name using Prep. After preparing call Scan().
func (Result) Prepx ¶
Prepare pointers to values to be populated by index using Prep. After preparing call Scan().
func (*Result) RowsAffected ¶
type Roller ¶
type Roller func(t Transaction, savepoint string)
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
func NewTransaction ¶
func NewTransaction(tran *rdb.Transaction) Transaction
Get the panic'ing version that doesn't return errors.
func (Transaction) Active ¶
func (must Transaction) Active() bool
func (Transaction) Commit ¶
func (must Transaction) Commit()
func (Transaction) Normal ¶
func (must Transaction) Normal() *rdb.Transaction
Get the non-panic'ing version of Transaction.
func (Transaction) Query ¶
Input parameter values can either be specified in the paremeter definition or on each query. If the value is not put in the parameter definition then the command instance may be reused for every query.
func (Transaction) Rollback ¶
func (must Transaction) Rollback()
func (Transaction) RollbackTo ¶
func (must Transaction) RollbackTo(savepoint string)
func (Transaction) SavePoint ¶
func (must Transaction) SavePoint(name string)