Documentation
¶
Index ¶
- Variables
- type DeleteStatement
- type Dialect
- type InsertStatement
- func (s InsertStatement) Build() (query string, args []interface{}, dest []interface{})
- func (s InsertStatement) Dialect(dialect Dialect) InsertStatement
- func (s InsertStatement) Into(table string) InsertStatement
- func (s InsertStatement) Return(col string, dest interface{}) InsertStatement
- func (s InsertStatement) Set(col string, val interface{}) InsertStatement
- func (s InsertStatement) SetSQL(col, sql string) InsertStatement
- type SelectStatement
- func (s SelectStatement) Build() (query string, args []interface{}, dest []interface{})
- func (s SelectStatement) Dialect(dialect Dialect) SelectStatement
- func (s SelectStatement) From(table string) SelectStatement
- func (s SelectStatement) Group(group string) SelectStatement
- func (s SelectStatement) Having(having string) SelectStatement
- func (s SelectStatement) Join(sql string, args ...interface{}) SelectStatement
- func (s SelectStatement) Limit(limit int) SelectStatement
- func (s SelectStatement) Lock() SelectStatement
- func (s SelectStatement) Map(col string, dest interface{}) SelectStatement
- func (s SelectStatement) Offset(offset int) SelectStatement
- func (s SelectStatement) Order(order string) SelectStatement
- func (s SelectStatement) Where(cond string, args ...interface{}) SelectStatement
- type UpdateStatement
- func (s UpdateStatement) Build() (query string, args []interface{})
- func (s UpdateStatement) Dialect(dialect Dialect) UpdateStatement
- func (s UpdateStatement) Set(col string, val interface{}) UpdateStatement
- func (s UpdateStatement) SetSQL(col string, sql string) UpdateStatement
- func (s UpdateStatement) Table(table string) UpdateStatement
- func (s UpdateStatement) Where(cond string, args ...interface{}) UpdateStatement
Constants ¶
This section is empty.
Variables ¶
var ( MySQL mysql.Dialect // MySQL SQLite mysql.Dialect // SQLite (same as MySQL) Postgres postgres.Dialect // Postgres )
var DefaultDialect = MySQL // Default dialect
Functions ¶
This section is empty.
Types ¶
type DeleteStatement ¶
type DeleteStatement struct {
// contains filtered or unexported fields
}
DeleteStatement represents a DELETE statement.
func Delete ¶
func Delete() DeleteStatement
Delete returns a new DELETE statement with the default dialect.
func (DeleteStatement) Build ¶
func (s DeleteStatement) Build() (query string, args []interface{})
Build builds the SQL query. It returns the query and the argument slice.
func (DeleteStatement) Dialect ¶
func (s DeleteStatement) Dialect(dialect Dialect) DeleteStatement
Dialect returns a new statement with dialect set to 'dialect'.
func (DeleteStatement) From ¶
func (s DeleteStatement) From(table string) DeleteStatement
From returns a new statement with the table to delete from set to 'table'.
func (DeleteStatement) Where ¶
func (s DeleteStatement) Where(cond string, args ...interface{}) DeleteStatement
Where returns a new statement with condition 'cond'. Multiple Where() are combined with AND.
type Dialect ¶
type Dialect interface {
// Placeholder returns the placeholder binding string for parameter at index idx.
Placeholder(idx int) string
}
Dialect represents a SQL dialect.
type InsertStatement ¶
type InsertStatement struct {
// contains filtered or unexported fields
}
InsertStatement represents an INSERT statement.
func Insert ¶
func Insert() InsertStatement
Insert returns a new INSERT statement with the default dialect.
func (InsertStatement) Build ¶
func (s InsertStatement) Build() (query string, args []interface{}, dest []interface{})
Build builds the SQL query. It returns the SQL query and the argument slice.
func (InsertStatement) Dialect ¶
func (s InsertStatement) Dialect(dialect Dialect) InsertStatement
Dialect returns a new statement with dialect set to 'dialect'.
func (InsertStatement) Into ¶
func (s InsertStatement) Into(table string) InsertStatement
Into returns a new statement with the table to insert into set to 'table'.
func (InsertStatement) Return ¶
func (s InsertStatement) Return(col string, dest interface{}) InsertStatement
Return returns a new statement with a RETURNING clause.
func (InsertStatement) Set ¶
func (s InsertStatement) Set(col string, val interface{}) InsertStatement
Set returns a new statement with column 'col' set to value 'val'.
func (InsertStatement) SetSQL ¶
func (s InsertStatement) SetSQL(col, sql string) InsertStatement
SetSQL returns a new statement with column 'col' set to the raw SQL expression 'sql'.
type SelectStatement ¶
type SelectStatement struct {
// contains filtered or unexported fields
}
SelectStatement represents a SELECT statement.
func Select ¶
func Select() SelectStatement
Select returns a new SELECT statement with the default dialect.
func (SelectStatement) Build ¶
func (s SelectStatement) Build() (query string, args []interface{}, dest []interface{})
Build builds the SQL query. It returns the query, the argument slice, and the destination slice.
func (SelectStatement) Dialect ¶
func (s SelectStatement) Dialect(dialect Dialect) SelectStatement
Dialect returns a new statement with dialect set to 'dialect'.
func (SelectStatement) From ¶
func (s SelectStatement) From(table string) SelectStatement
From returns a new statement with the table to select from set to 'table'.
func (SelectStatement) Group ¶
func (s SelectStatement) Group(group string) SelectStatement
Group returns a new statement with grouping 'group'. Only the last Group() is used.
func (SelectStatement) Having ¶
func (s SelectStatement) Having(having string) SelectStatement
Having returns a new statement with HAVING condition 'having'. Only the last Having() is used.
func (SelectStatement) Join ¶
func (s SelectStatement) Join(sql string, args ...interface{}) SelectStatement
Join returns a new statement with JOIN expression 'sql'.
func (SelectStatement) Limit ¶
func (s SelectStatement) Limit(limit int) SelectStatement
Limit returns a new statement with the limit set to 'limit'.
func (SelectStatement) Lock ¶
func (s SelectStatement) Lock() SelectStatement
Lock returns a new statement with FOR UPDATE locking.
func (SelectStatement) Map ¶
func (s SelectStatement) Map(col string, dest interface{}) SelectStatement
Map returns a new statement with column 'col' selected and scanned into 'dest'. 'dest' may be nil if the value should not be scanned.
func (SelectStatement) Offset ¶
func (s SelectStatement) Offset(offset int) SelectStatement
Offset returns a new statement with the offset set to 'offset'.
func (SelectStatement) Order ¶
func (s SelectStatement) Order(order string) SelectStatement
Order returns a new statement with ordering 'order'. Only the last Order() is used.
func (SelectStatement) Where ¶
func (s SelectStatement) Where(cond string, args ...interface{}) SelectStatement
Where returns a new statement with condition 'cond'. Multiple conditions are combined with AND.
type UpdateStatement ¶
type UpdateStatement struct {
// contains filtered or unexported fields
}
UpdateStatement represents an UPDATE statement.
func Update ¶
func Update() UpdateStatement
Update returns a new UPDATE statement with the default dialect.
func (UpdateStatement) Build ¶
func (s UpdateStatement) Build() (query string, args []interface{})
Build builds the SQL query. It returns the query and the argument slice.
func (UpdateStatement) Dialect ¶
func (s UpdateStatement) Dialect(dialect Dialect) UpdateStatement
Dialect returns a new statement with dialect set to 'dialect'.
func (UpdateStatement) Set ¶
func (s UpdateStatement) Set(col string, val interface{}) UpdateStatement
Set returns a new statement with column 'col' set to value 'val'.
func (UpdateStatement) SetSQL ¶
func (s UpdateStatement) SetSQL(col string, sql string) UpdateStatement
SetSQL returns a new statement with column 'col' set to SQL expression 'sql'.
func (UpdateStatement) Table ¶
func (s UpdateStatement) Table(table string) UpdateStatement
Table returns a new statement with the table to update set to 'table'.
func (UpdateStatement) Where ¶
func (s UpdateStatement) Where(cond string, args ...interface{}) UpdateStatement
Where returns a new statement with condition 'cond'. Multiple Where() are combined with AND.