Documentation ¶
Index ¶
- type DB
- type Driver
- func (d Driver) BoolString(v bool) string
- func (d Driver) Limit(sql qb.SQL, limit 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) (sql.Result, error)
- func (db QueryTarget) Prepare(q qb.Query) (*Stmt, error)
- func (db QueryTarget) Query(q qb.SelectQuery) (*sql.Rows, error)
- func (db QueryTarget) QueryRow(q qb.SelectQuery) *sql.Row
- func (db QueryTarget) RawExec(s string, v ...interface{}) (sql.Result, error)
- func (db QueryTarget) Render(q qb.Query) (string, []interface{})
- 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) 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) 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) (*sql.Rows, error)
Query executes the given SelectQuery on the database
func (QueryTarget) QueryRow ¶
func (db QueryTarget) QueryRow(q qb.SelectQuery) *sql.Row
QueryRow executes the given SelectQuery on the database, only returns one row
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) (*sql.Rows, error) QueryRow(qb.SelectQuery) *sql.Row Exec(q qb.Query) (sql.Result, error) RawExec(s string, v ...interface{}) (sql.Result, error) Prepare(q qb.Query) (*Stmt, error) }
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
Click to show internal directories.
Click to hide internal directories.