Documentation ¶
Index ¶
- Variables
- func WithRecovery(v func(exception interface{}) error) func(*txOption)
- func WithRollback(v func(rollback func() error, cause error) error) func(*txOption)
- func WithSessionTx(ctx context.Context, db DB, fn func(context.Context) error, ...) (err error)
- func WithSqlTxOptions(v *sql.TxOptions) func(*txOption)
- func WithTx(ctx context.Context, db DB, fn func(context.Context, Conn) error) (err error)
- func WithTxOptions(ctx context.Context, opts ...func(*txOption)) context.Context
- type Conn
- type DB
- type FieldMapping
- type Litorm
- func (orm Litorm) Insert(ctx context.Context, ignore bool, model Model, fields []string, ...) (result sql.Result, err error)
- func (orm Litorm) Inserts(ctx context.Context, ignore bool, models ModelIterator, fields []string, ...) (result sql.Result, err error)
- func (orm Litorm) Select(ctx context.Context, model Model, fields []string, ext ...interface{}) (err error)
- func (orm Litorm) Selects(ctx context.Context, models ModelIterator, fields []string, ext ...interface{}) (err error)
- func (orm Litorm) Update(ctx context.Context, model Model, fields []string, condition string, ...) (result sql.Result, err error)
- type Model
- type ModelIterator
- type SqlBuilder
- func (bd *SqlBuilder) BuildInsert(models ModelIterator, ignore bool, fields []string, ext []interface{}) (args []interface{}, err error)
- func (bd *SqlBuilder) BuildSelect(model Model, fields []string, ext []interface{}) (args []interface{})
- func (bd *SqlBuilder) BuildUpdate(model Model, fields []string, ext string, xargs []interface{}) (args []interface{})
- func (bd *SqlBuilder) WriteExtArgs(ext []interface{}, args *[]interface{})
- func (bd *SqlBuilder) WriteFields(fields []string, name bool, suffix, sep string)
- func (bd *SqlBuilder) WriteTable(table string)
- type StmtCacheConn
- func (sc *StmtCacheConn) Close() error
- func (sc *StmtCacheConn) ExecContext(ctx context.Context, statement string, args ...interface{}) (res sql.Result, err error)
- func (sc *StmtCacheConn) PrepareContext(ctx context.Context, statement string) (*sql.Stmt, error)
- func (sc *StmtCacheConn) QueryContext(ctx context.Context, statement string, args ...interface{}) (rows *sql.Rows, err error)
- func (sc *StmtCacheConn) QueryRowContext(ctx context.Context, statement string, args ...interface{}) *sql.Row
- type Tx
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidModelsIterator = errors.New("invalid models iterator")
Functions ¶
func WithRecovery ¶
func WithRecovery(v func(exception interface{}) error) func(*txOption)
func WithRollback ¶
func WithSessionTx ¶
func WithSqlTxOptions ¶
Types ¶
type Conn ¶
type Conn interface { QueryContext(ctx context.Context, statement string, args ...interface{}) (*sql.Rows, error) QueryRowContext(ctx context.Context, statement string, args ...interface{}) *sql.Row ExecContext(ctx context.Context, statement string, args ...interface{}) (sql.Result, error) PrepareContext(ctx context.Context, statement string) (*sql.Stmt, error) }
type FieldMapping ¶
type FieldMapping map[string]interface{}
func (FieldMapping) MapFields ¶
func (mapping FieldMapping) MapFields(model Model, fp *[]string)
func (FieldMapping) MapValues ¶
func (mapping FieldMapping) MapValues(fields []string, ptr *[]interface{})
type Litorm ¶
type Litorm struct{ Conn }
type ModelIterator ¶
type SqlBuilder ¶
func (*SqlBuilder) BuildInsert ¶
func (bd *SqlBuilder) BuildInsert(models ModelIterator, ignore bool, fields []string, ext []interface{}) (args []interface{}, err error)
func (*SqlBuilder) BuildSelect ¶
func (bd *SqlBuilder) BuildSelect(model Model, fields []string, ext []interface{}) (args []interface{})
func (*SqlBuilder) BuildUpdate ¶
func (bd *SqlBuilder) BuildUpdate(model Model, fields []string, ext string, xargs []interface{}) (args []interface{})
func (*SqlBuilder) WriteExtArgs ¶
func (bd *SqlBuilder) WriteExtArgs(ext []interface{}, args *[]interface{})
func (*SqlBuilder) WriteFields ¶
func (bd *SqlBuilder) WriteFields(fields []string, name bool, suffix, sep string)
func (*SqlBuilder) WriteTable ¶
func (bd *SqlBuilder) WriteTable(table string)
type StmtCacheConn ¶
type StmtCacheConn struct { Conn Conn // contains filtered or unexported fields }
func NewStmtCacher ¶
func NewStmtCacher(conn Conn) *StmtCacheConn
func (*StmtCacheConn) Close ¶
func (sc *StmtCacheConn) Close() error
func (*StmtCacheConn) ExecContext ¶
func (*StmtCacheConn) PrepareContext ¶
func (*StmtCacheConn) QueryContext ¶
func (*StmtCacheConn) QueryRowContext ¶
Click to show internal directories.
Click to hide internal directories.