Documentation ¶
Index ¶
- type DB
- type Driver
- func (d Driver) BoolString(v bool) string
- func (d Driver) IgnoreConflictSQL(_ *qb.Table, _ []qb.Field) (string, []interface{})
- func (d Driver) LimitOffset(sql qb.SQL, limit, offset int)
- func (d Driver) Override() qb.OverrideMap
- func (d Driver) Returning(b qb.SQLBuilder, q qb.Query, f []qb.Field) (string, []interface{})
- func (d Driver) TypeName(t qb.DataType) string
- func (d Driver) UpsertSQL(_ *qb.Table, _ []qb.Field, _ qb.Query) (string, []interface{})
- func (d Driver) ValueString(c int) string
- type QueryTarget
- func (db QueryTarget) Exec(q qb.Query) (Result, error)
- func (db QueryTarget) MustExec(q qb.Query) Result
- func (db QueryTarget) MustPrepare(q qb.Query) *Stmt
- func (db QueryTarget) MustQuery(q qb.SelectQuery) Rows
- func (db QueryTarget) MustRawExec(s string, v ...interface{}) Result
- func (db QueryTarget) Prepare(q qb.Query) (*Stmt, error)
- func (db QueryTarget) Query(q qb.SelectQuery) (Rows, error)
- func (db QueryTarget) QueryRow(q qb.SelectQuery) Row
- func (db QueryTarget) RawExec(s string, v ...interface{}) (Result, error)
- func (db QueryTarget) Render(q qb.Query) (string, []interface{})
- type Result
- type Row
- type Rows
- type Stmt
- type Target
- type Tx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct{}
Driver is a default driver used for tests
func (Driver) BoolString ¶
BoolString returns the notation for boolean values
func (Driver) IgnoreConflictSQL ¶
IgnoreConflictSQL implements qb.Driver
func (Driver) LimitOffset ¶
LimitOffset implements qb.Driver
func (Driver) Override ¶
func (d Driver) Override() qb.OverrideMap
Override returns the override map
func (Driver) ValueString ¶
ValueString returns the placeholder for prepare values
type QueryTarget ¶
QueryTarget is a sql.DB or sql.Tx
func (QueryTarget) Exec ¶
func (db QueryTarget) Exec(q qb.Query) (Result, error)
Exec executes the given query, returns only an error
func (QueryTarget) MustExec ¶
func (db QueryTarget) MustExec(q qb.Query) Result
MustExec executes the given query If an error occurs returned it will panic
func (QueryTarget) MustPrepare ¶
func (db QueryTarget) MustPrepare(q qb.Query) *Stmt
MustPrepare prepares a query for efficient repeated executions If an error occurs returned it will panic
func (QueryTarget) MustQuery ¶
func (db QueryTarget) MustQuery(q qb.SelectQuery) Rows
MustQuery executes the given SelectQuery on the database If an error occurs returned it will panic
func (QueryTarget) MustRawExec ¶
func (db QueryTarget) MustRawExec(s string, v ...interface{}) Result
MustRawExec executes the given SQL with the given params directly on the database If an error occurs returned it will panic
func (QueryTarget) Prepare ¶
func (db QueryTarget) Prepare(q qb.Query) (*Stmt, error)
Prepare prepares a query for efficient repeated executions
func (QueryTarget) Query ¶
func (db QueryTarget) Query(q qb.SelectQuery) (Rows, error)
Query executes the given SelectQuery on the database
func (QueryTarget) QueryRow ¶
func (db QueryTarget) QueryRow(q qb.SelectQuery) Row
QueryRow executes the given SelectQuery on the database, only returns one row
type Result ¶
Result is a wrapper for sql.Result that adds MustLastInsertId and MustRowsAffected
func (Result) MustLastInsertId ¶
MustLastInsertId is the same as LastInsertId except if an error occurs returned it will panic
func (Result) MustRowsAffected ¶
MustRowsAffected is the same as RowsAffected except if an error occurs returned it will panic
type Stmt ¶
type Stmt struct {
// contains filtered or unexported fields
}
Stmt represents a prepared statement in the database
type Target ¶
type Target interface { Render(qb.Query) (string, []interface{}) Query(qb.SelectQuery) (Rows, error) MustQuery(qb.SelectQuery) Rows QueryRow(qb.SelectQuery) Row Exec(q qb.Query) (Result, error) MustExec(q qb.Query) Result RawExec(s string, v ...interface{}) (Result, error) MustRawExec(s string, v ...interface{}) Result Prepare(q qb.Query) (*Stmt, error) MustPrepare(q qb.Query) *Stmt }
Target is a target for a query, either a plain DB or a Tx
type Tx ¶
type Tx struct { QueryTarget // contains filtered or unexported fields }
Tx is a transaction
func (Tx) MustCommit ¶
func (t Tx) MustCommit()
MustCommit is the same as Commit, but it panics if an error occurred