Documentation
¶
Index ¶
- type Command
- type Context
- func (c *Context) Begin() error
- func (c *Context) Clone(ctx context.Context) *Context
- func (c *Context) Commit() error
- func (c *Context) NewCommand() *Command
- func (c *Context) NewQuery() *Query
- func (c *Context) RawDB() *sql.DB
- func (c *Context) Rollback() error
- func (c *Context) TraceSlowSQL(status bool, t *time.Duration)
- type Query
- type SQLBuilder
- func (sb *SQLBuilder) Limit(size, index int64)
- func (sb *SQLBuilder) OrderBy(clause string)
- func (sb *SQLBuilder) RawSQL(sql string)
- func (sb *SQLBuilder) SetOrderColumn(clientColName, dbColName string)
- func (sb *SQLBuilder) String() string
- func (sb *SQLBuilder) Var(name string, value interface{}, predicate bool)
- func (sb *SQLBuilder) Vars() *Vars
- func (sb *SQLBuilder) WhereAnd(clause string)
- func (sb *SQLBuilder) WhereOr(clause string)
- type Vars
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct { SQLBuilder // contains filtered or unexported fields }
Command a db command
type Context ¶
Context db context
func NewContext ¶
NewContext create a db context instance, is not thread safe
func (*Context) NewCommand ¶
NewCommand return a new command
type Query ¶
type Query struct { SQLBuilder // contains filtered or unexported fields }
Query query data in db
type SQLBuilder ¶
type SQLBuilder struct {
// contains filtered or unexported fields
}
SQLBuilder sql builder
func (*SQLBuilder) Limit ¶
func (sb *SQLBuilder) Limit(size, index int64)
Limit set limit clause,ignore when size is 0
func (*SQLBuilder) OrderBy ¶
func (sb *SQLBuilder) OrderBy(clause string)
OrderBy set order by clause
func (*SQLBuilder) SetOrderColumn ¶
func (sb *SQLBuilder) SetOrderColumn(clientColName, dbColName string)
SetOrderColumn add orderable column mapping, prevent sql injection
func (*SQLBuilder) String ¶
func (sb *SQLBuilder) String() string
String implements Stringer, return final sql
func (*SQLBuilder) Var ¶
func (sb *SQLBuilder) Var(name string, value interface{}, predicate bool)
Var add/update variable
func (*SQLBuilder) WhereAnd ¶
func (sb *SQLBuilder) WhereAnd(clause string)
WhereAnd add a and where clause
func (*SQLBuilder) WhereOr ¶
func (sb *SQLBuilder) WhereOr(clause string)
WhereOr add a or where clause
Click to show internal directories.
Click to hide internal directories.