Documentation ¶
Index ¶
- func BuildWhereSQL(d core.Dialect, values []core.Expression) (core.SQL, error)
- func CombinePathSQL(d core.Dialect, paths []core.Expression) (core.SQL, error)
- func CombineSQL(d core.Dialect, paths []core.Expression) (core.SQL, error)
- func ExpandTables(paths []core.Expression) []core.Expression
- func NewNamedOnlyColumn(name, parent string) *stringColumn
- type DeleteQuery
- type InsertQuery
- func (i *InsertQuery) Columns(columns ...core.Column) *InsertQuery
- func (i *InsertQuery) GetSQL(d core.Dialect) (core.SQL, error)
- func (i *InsertQuery) Select(s *SelectQuery) *InsertQuery
- func (i *InsertQuery) Values(values ...core.Expression) *InsertQuery
- func (i *InsertQuery) ValuesConstants(values ...interface{}) *InsertQuery
- type Modifier
- type SelectQuery
- func (s *SelectQuery) From(e core.Table) *SelectQuery
- func (s *SelectQuery) GetSQL(d core.Dialect) (core.SQL, error)
- func (s *SelectQuery) Join(left core.Expression, jt expression.JoinType, on core.Expression) *SelectQuery
- func (s *SelectQuery) OrderBy(exp core.Expression, direction sort.Direction) *SelectQuery
- func (s *SelectQuery) Where(exp ...core.Expression) *SelectQuery
- type UpdateQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildWhereSQL ¶
func CombinePathSQL ¶
CombinePathSQL will validate each path is not nil, and will append n+1 with a comma separating them
func CombineSQL ¶
CombineSQL will validate each path is not nil, and will append each SQL to the previous with a single space between each.
func ExpandTables ¶
func ExpandTables(paths []core.Expression) []core.Expression
func NewNamedOnlyColumn ¶
func NewNamedOnlyColumn(name, parent string) *stringColumn
NewNamedOnlyColumn creates a `core.Column` of which only the name of the column is filled out. Thus, when `GetSQL()` is called, only a single SQL with the value of `name` is returned.
Types ¶
type DeleteQuery ¶
type DeleteQuery struct {
// contains filtered or unexported fields
}
func (DeleteQuery) Join ¶
func (d DeleteQuery) Join(left core.Expression, jt expression.JoinType, on core.Expression) *DeleteQuery
DELETE w FROM WorkRecord2 w LEFT JOIN Employee e ON EmployeeRun=EmployeeNo WHERE w.Company = '1' AND e.Date = '2013-05-06'
func (DeleteQuery) Where ¶
func (d DeleteQuery) Where(exp ...core.Expression) *DeleteQuery
type InsertQuery ¶
type InsertQuery struct {
// contains filtered or unexported fields
}
func InsertInto ¶
func InsertInto(entity core.Table) *InsertQuery
func (*InsertQuery) Columns ¶
func (i *InsertQuery) Columns(columns ...core.Column) *InsertQuery
func (*InsertQuery) Select ¶
func (i *InsertQuery) Select(s *SelectQuery) *InsertQuery
Select allows passing in a Select Query the following insert statements:
INSERT INTO table1 (uuid, name) SELECT UNHEX("1234567891230"), a.name FROM table2 as a LEFT JOIN table1 as b ON a.name=b.remote_name WHERE b.remote_name = 'other_table';
func (*InsertQuery) Values ¶
func (i *InsertQuery) Values(values ...core.Expression) *InsertQuery
Values allows inserting expressions with SQL functions:
INSERT INTO table1 (uuid, name) values (UNHEX("1234567891234"), 'name1');
func (*InsertQuery) ValuesConstants ¶
func (i *InsertQuery) ValuesConstants(values ...interface{}) *InsertQuery
ValuesConstants allows inserting constant values:
INSERT INTO table1 (id, name, internal_name) values (123456, 'name1', 'internal_name');
type SelectQuery ¶
type SelectQuery struct {
// contains filtered or unexported fields
}
func Select ¶
func Select(paths ...core.Expression) *SelectQuery
func SelectFrom ¶
func SelectFrom(e core.Table) *SelectQuery
func (*SelectQuery) From ¶
func (s *SelectQuery) From(e core.Table) *SelectQuery
func (*SelectQuery) Join ¶
func (s *SelectQuery) Join(left core.Expression, jt expression.JoinType, on core.Expression) *SelectQuery
func (*SelectQuery) OrderBy ¶
func (s *SelectQuery) OrderBy(exp core.Expression, direction sort.Direction) *SelectQuery
func (*SelectQuery) Where ¶
func (s *SelectQuery) Where(exp ...core.Expression) *SelectQuery
type UpdateQuery ¶
type UpdateQuery struct {
// contains filtered or unexported fields
}
func Update ¶
func Update(table core.Table) *UpdateQuery
func (UpdateQuery) Set ¶
func (u UpdateQuery) Set(exp ...core.Set) *UpdateQuery
func (UpdateQuery) Where ¶
func (u UpdateQuery) Where(exp ...core.Expression) *UpdateQuery