Documentation ¶
Index ¶
- func New(dsn string) dbal.Grammar
- type Quoter
- func (quoter *Quoter) Bind(db *sqlx.DB, prefix string, dbRead ...*sqlx.DB) dbal.Quoter
- func (quoter *Quoter) Columnize(columns []interface{}) string
- func (quoter *Quoter) ID(value string) string
- func (quoter *Quoter) IsExpression(value interface{}) bool
- func (quoter *Quoter) Parameter(value interface{}, num int) string
- func (quoter *Quoter) Parameterize(values []interface{}, offset int) string
- func (quoter *Quoter) Read() dbal.Quoter
- func (quoter *Quoter) VAL(value interface{}) string
- func (quoter *Quoter) Wrap(value interface{}) string
- func (quoter *Quoter) WrapAliasedValue(value string) string
- func (quoter *Quoter) WrapTable(value interface{}) string
- func (quoter *Quoter) WrapUnion(sql string) string
- func (quoter *Quoter) Write() dbal.Quoter
- type SQL
- func (grammarSQL SQL) AlterTable(table *dbal.Table) error
- func (grammarSQL SQL) CompileAggregate(query *dbal.Query, aggregate dbal.Aggregate) string
- func (grammarSQL SQL) CompileColumns(query *dbal.Query, columns []interface{}, bindingOffset *int) string
- func (grammarSQL SQL) CompileDelete(query *dbal.Query) (string, []interface{})
- func (grammarSQL SQL) CompileExists(query *dbal.Query) string
- func (grammarSQL SQL) CompileFrom(query *dbal.Query, from dbal.From, bindingOffset *int) string
- func (grammarSQL SQL) CompileGroups(query *dbal.Query, groups []interface{}, bindingOffset *int) string
- func (grammarSQL SQL) CompileHaving(query *dbal.Query, having dbal.Having, bindingOffset *int) string
- func (grammarSQL SQL) CompileHavings(query *dbal.Query, havings []dbal.Having, bindingOffset *int) string
- func (grammarSQL SQL) CompileInsert(query *dbal.Query, columns []interface{}, values [][]interface{}) (string, []interface{})
- func (grammarSQL SQL) CompileInsertGetID(query *dbal.Query, columns []interface{}, values [][]interface{}, ...) (string, []interface{})
- func (grammarSQL SQL) CompileInsertOrIgnore(query *dbal.Query, columns []interface{}, values [][]interface{}) (string, []interface{})
- func (grammarSQL SQL) CompileInsertUsing(query *dbal.Query, columns []interface{}, sql string) string
- func (grammarSQL SQL) CompileJoins(query *dbal.Query, joins []dbal.Join, offset *int) string
- func (grammarSQL SQL) CompileLimit(query *dbal.Query, limit int, bindingOffset *int) string
- func (grammarSQL SQL) CompileLock(query *dbal.Query, lock interface{}) string
- func (grammarSQL SQL) CompileOffset(query *dbal.Query, offset int) string
- func (grammarSQL SQL) CompileOrders(query *dbal.Query, orders []dbal.Order, bindingOffset *int) string
- func (grammarSQL SQL) CompileSelect(query *dbal.Query) string
- func (grammarSQL SQL) CompileSelectOffset(query *dbal.Query, offset *int) string
- func (grammarSQL SQL) CompileSub(sub interface{}, offset *int) string
- func (grammarSQL SQL) CompileTruncate(query *dbal.Query) ([]string, [][]interface{})
- func (grammarSQL SQL) CompileUnion(query *dbal.Query, union dbal.Union, offset *int) string
- func (grammarSQL SQL) CompileUnionAggregate(query *dbal.Query) string
- func (grammarSQL SQL) CompileUnions(query *dbal.Query, unions []dbal.Union, offset *int) string
- func (grammarSQL SQL) CompileUpdate(query *dbal.Query, values map[string]interface{}) (string, []interface{})
- func (grammarSQL SQL) CompileUpdateColumns(query *dbal.Query, values map[string]interface{}, offset *int) (string, []interface{})
- func (grammarSQL SQL) CompileUpsert(query *dbal.Query, columns []interface{}, values [][]interface{}, ...) (string, []interface{})
- func (grammarSQL SQL) CompileWheres(query *dbal.Query, wheres []dbal.Where, bindingOffset *int) string
- func (grammarSQL SQL) CreateTable(table *dbal.Table) error
- func (grammarSQL SQL) DropTable(name string) error
- func (grammarSQL SQL) DropTableIfExists(name string) error
- func (grammarSQL SQL) ExecSQL(table *dbal.Table, sql string) error
- func (grammarSQL SQL) GetColumnListing(dbName string, tableName string) ([]*dbal.Column, error)
- func (grammarSQL SQL) GetDatabase() string
- func (grammarSQL SQL) GetDefaultValue(column *dbal.Column) string
- func (grammarSQL SQL) GetIndexListing(dbName string, tableName string) ([]*dbal.Index, error)
- func (grammarSQL SQL) GetOperators() []string
- func (grammarSQL SQL) GetSchema() string
- func (grammarSQL SQL) GetTable(name string) (*dbal.Table, error)
- func (grammarSQL SQL) GetTables() ([]string, error)
- func (grammarSQL SQL) GetTypeFromComment(comment *string) string
- func (grammarSQL SQL) GetVersion() (*dbal.Version, error)
- func (grammarSQL SQL) HavingBasic(query *dbal.Query, having dbal.Having, bindingOffset *int) string
- func (grammarSQL SQL) HavingBetween(query *dbal.Query, having dbal.Having, bindingOffset *int) string
- func (grammarSQL SQL) NewWith(db *sqlx.DB, config *dbal.Config, option *dbal.Option) (dbal.Grammar, error)
- func (grammarSQL SQL) NewWithRead(write *sqlx.DB, writeConfig *dbal.Config, read *sqlx.DB, ...) (dbal.Grammar, error)
- func (grammarSQL SQL) OnConnected() error
- func (grammarSQL SQL) ProcessInsertGetID(sql string, bindings []interface{}, sequence string) (int64, error)
- func (grammarSQL SQL) Raw(value string) dbal.Expression
- func (grammarSQL SQL) RemoveLeadingBoolean(value string) string
- func (grammarSQL SQL) RenameTable(old string, new string) error
- func (grammarSQL SQL) SQLAddColumn(column *dbal.Column) string
- func (grammarSQL SQL) SQLAddIndex(index *dbal.Index) string
- func (grammarSQL SQL) SQLAddPrimary(primary *dbal.Primary) string
- func (grammarSQL SQL) TableExists(name string) (bool, error)
- func (grammarSQL SQL) WhereBasic(query *dbal.Query, where dbal.Where, bindingOffset *int) string
- func (grammarSQL SQL) WhereBetween(query *dbal.Query, where dbal.Where, bindingOffset *int) string
- func (grammarSQL SQL) WhereColumn(query *dbal.Query, where dbal.Where, bindingOffset *int) string
- func (grammarSQL SQL) WhereDate(query *dbal.Query, where dbal.Where, bindingOffset *int) string
- func (grammarSQL SQL) WhereDateBased(typ string, query *dbal.Query, where dbal.Where, bindingOffset *int) string
- func (grammarSQL SQL) WhereDay(query *dbal.Query, where dbal.Where, bindingOffset *int) string
- func (grammarSQL SQL) WhereExists(query *dbal.Query, where dbal.Where, bindingOffset *int) string
- func (grammarSQL SQL) WhereIn(query *dbal.Query, where dbal.Where, bindingOffset *int) string
- func (grammarSQL SQL) WhereMonth(query *dbal.Query, where dbal.Where, bindingOffset *int) string
- func (grammarSQL SQL) WhereNested(query *dbal.Query, where dbal.Where, bindingOffset *int) string
- func (grammarSQL SQL) WhereNotnull(query *dbal.Query, where dbal.Where, bindingOffset *int) string
- func (grammarSQL SQL) WhereNull(query *dbal.Query, where dbal.Where, bindingOffset *int) string
- func (grammarSQL SQL) WhereRaw(query *dbal.Query, where dbal.Where, bindingOffset *int) string
- func (grammarSQL SQL) WhereSub(query *dbal.Query, where dbal.Where, bindingOffset *int) string
- func (grammarSQL SQL) WhereTime(query *dbal.Query, where dbal.Where, bindingOffset *int) string
- func (grammarSQL SQL) WhereYear(query *dbal.Query, where dbal.Where, bindingOffset *int) string
- func (grammarSQL SQL) Wrap(value interface{}) string
- func (grammarSQL SQL) WrapTable(value interface{}) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Quoter ¶
Quoter the database quoting query text SQL type
func (*Quoter) Columnize ¶ added in v0.5.1
Columnize Convert an array of column names into a delimited string.
func (*Quoter) IsExpression ¶ added in v0.5.1
IsExpression Determine if the given value is a raw expression.
func (*Quoter) Parameter ¶ added in v0.5.1
Parameter Get the appropriate query parameter place-holder for a value.
func (*Quoter) Parameterize ¶ added in v0.5.1
Parameterize Create query parameter place-holders for an array.
func (*Quoter) WrapAliasedValue ¶ added in v0.5.1
WrapAliasedValue Wrap a value that has an alias.
type SQL ¶
type SQL struct { Driver string Mode string Types map[string]string FlipTypes map[string]string IndexTypes map[string]string DatabaseName string SchemaName string DB *sqlx.DB Config *dbal.Config Read *sqlx.DB ReadConfig *dbal.Config Option *dbal.Option dbal.Grammar dbal.Quoter }
SQL the SQL Grammar
func (SQL) AlterTable ¶ added in v0.0.3
AlterTable alter a table on the schema
func (SQL) CompileAggregate ¶ added in v0.5.1
CompileAggregate Compile an aggregated select clause.
func (SQL) CompileColumns ¶ added in v0.5.1
func (grammarSQL SQL) CompileColumns(query *dbal.Query, columns []interface{}, bindingOffset *int) string
CompileColumns Compile the "select *" portion of the query.
func (SQL) CompileDelete ¶ added in v0.5.1
CompileDelete Compile a delete statement into SQL.
func (SQL) CompileExists ¶ added in v0.5.1
CompileExists Compile an exists statement into SQL.
func (SQL) CompileFrom ¶ added in v0.5.1
CompileFrom Compile the "from" portion of the query.
func (SQL) CompileGroups ¶ added in v0.5.1
func (grammarSQL SQL) CompileGroups(query *dbal.Query, groups []interface{}, bindingOffset *int) string
CompileGroups Compile the "group by" portions of the query.
func (SQL) CompileHaving ¶ added in v0.5.1
func (grammarSQL SQL) CompileHaving(query *dbal.Query, having dbal.Having, bindingOffset *int) string
CompileHaving Compile a single having clause.
func (SQL) CompileHavings ¶ added in v0.5.1
func (grammarSQL SQL) CompileHavings(query *dbal.Query, havings []dbal.Having, bindingOffset *int) string
CompileHavings Compile the "having" portions of the query.
func (SQL) CompileInsert ¶ added in v0.5.1
func (grammarSQL SQL) CompileInsert(query *dbal.Query, columns []interface{}, values [][]interface{}) (string, []interface{})
CompileInsert Compile an insert statement into SQL.
func (SQL) CompileInsertGetID ¶ added in v0.5.1
func (grammarSQL SQL) CompileInsertGetID(query *dbal.Query, columns []interface{}, values [][]interface{}, sequence string) (string, []interface{})
CompileInsertGetID Compile an insert and get ID statement into SQL.
func (SQL) CompileInsertOrIgnore ¶ added in v0.5.1
func (grammarSQL SQL) CompileInsertOrIgnore(query *dbal.Query, columns []interface{}, values [][]interface{}) (string, []interface{})
CompileInsertOrIgnore Compile an insert ignore statement into SQL.
func (SQL) CompileInsertUsing ¶ added in v0.5.1
func (grammarSQL SQL) CompileInsertUsing(query *dbal.Query, columns []interface{}, sql string) string
CompileInsertUsing Compile an insert statement using a subquery into SQL.
func (SQL) CompileJoins ¶ added in v0.5.1
CompileJoins Compile the "join" portions of the query.
func (SQL) CompileLimit ¶ added in v0.5.1
CompileLimit Compile the "limit" portions of the query.
func (SQL) CompileLock ¶ added in v0.5.1
CompileLock the lock into SQL.
func (SQL) CompileOffset ¶ added in v0.5.1
CompileOffset Compile the "offset" portions of the query.
func (SQL) CompileOrders ¶ added in v0.5.1
func (grammarSQL SQL) CompileOrders(query *dbal.Query, orders []dbal.Order, bindingOffset *int) string
CompileOrders Compile the "order by" portions of the query.
func (SQL) CompileSelect ¶ added in v0.5.1
CompileSelect Compile a select query into SQL.
func (SQL) CompileSelectOffset ¶ added in v0.5.1
CompileSelectOffset Compile a select query into SQL.
func (SQL) CompileSub ¶ added in v0.5.1
CompileSub Parse the subquery into SQL and bindings.
func (SQL) CompileTruncate ¶ added in v0.5.1
CompileTruncate Compile a truncate table statement into SQL.
func (SQL) CompileUnion ¶ added in v0.5.1
CompileUnion Compile a single union statement.
func (SQL) CompileUnionAggregate ¶ added in v0.5.1
CompileUnionAggregate Compile a union aggregate query into SQL.
func (SQL) CompileUnions ¶ added in v0.5.1
CompileUnions Compile the "union" queries attached to the main query.
func (SQL) CompileUpdate ¶ added in v0.5.1
func (grammarSQL SQL) CompileUpdate(query *dbal.Query, values map[string]interface{}) (string, []interface{})
CompileUpdate Compile an update statement into SQL.
func (SQL) CompileUpdateColumns ¶ added in v0.5.1
func (grammarSQL SQL) CompileUpdateColumns(query *dbal.Query, values map[string]interface{}, offset *int) (string, []interface{})
CompileUpdateColumns Compile the columns for an update statement.
func (SQL) CompileUpsert ¶ added in v0.5.1
func (grammarSQL SQL) CompileUpsert(query *dbal.Query, columns []interface{}, values [][]interface{}, uniqueBy []interface{}, updateValues interface{}) (string, []interface{})
CompileUpsert Compile an "upsert" statement into SQL.
func (SQL) CompileWheres ¶ added in v0.5.1
func (grammarSQL SQL) CompileWheres(query *dbal.Query, wheres []dbal.Where, bindingOffset *int) string
CompileWheres Compile an update statement into SQL.
func (SQL) CreateTable ¶ added in v0.0.3
CreateTable create a new table on the schema
func (SQL) DropTableIfExists ¶ added in v0.0.3
DropTableIfExists if the table exists, drop it from the schema.
func (SQL) GetColumnListing ¶
GetColumnListing get a table columns structure
func (SQL) GetDatabase ¶ added in v0.0.3
GetDatabase get the database name of the current connection
func (SQL) GetDefaultValue ¶ added in v0.5.1
GetDefaultValue get the default value
func (SQL) GetIndexListing ¶
GetIndexListing get a table indexes structure
func (SQL) GetOperators ¶ added in v0.5.1
GetOperators get the operators
func (SQL) GetTypeFromComment ¶ added in v0.0.3
GetTypeFromComment Get the type name from comment
func (SQL) GetVersion ¶ added in v0.0.3
GetVersion get the version of the connection database
func (SQL) HavingBasic ¶ added in v0.5.1
HavingBasic Compile a basic having clause.
func (SQL) HavingBetween ¶ added in v0.5.1
func (grammarSQL SQL) HavingBetween(query *dbal.Query, having dbal.Having, bindingOffset *int) string
HavingBetween Compile a "between" having clause.
func (SQL) NewWith ¶ added in v0.0.3
func (grammarSQL SQL) NewWith(db *sqlx.DB, config *dbal.Config, option *dbal.Option) (dbal.Grammar, error)
NewWith Create a new grammar interface, using the given *sqlx.DB, *dbal.Config and *dbal.Option.
func (SQL) NewWithRead ¶ added in v0.5.1
func (grammarSQL SQL) NewWithRead(write *sqlx.DB, writeConfig *dbal.Config, read *sqlx.DB, readConfig *dbal.Config, option *dbal.Option) (dbal.Grammar, error)
NewWithRead Create a new grammar interface, using the given *sqlx.DB, *dbal.Config and *dbal.Option.
func (SQL) OnConnected ¶ added in v0.0.3
OnConnected the event will be triggered when db server was connected
func (SQL) ProcessInsertGetID ¶ added in v0.5.1
func (grammarSQL SQL) ProcessInsertGetID(sql string, bindings []interface{}, sequence string) (int64, error)
ProcessInsertGetID Execute an insert and get ID statement and return the id
func (SQL) Raw ¶ added in v0.5.1
func (grammarSQL SQL) Raw(value string) dbal.Expression
Raw make a new expression
func (SQL) RemoveLeadingBoolean ¶ added in v0.5.1
RemoveLeadingBoolean Remove the leading boolean from a statement.
func (SQL) RenameTable ¶ added in v0.0.3
RenameTable rename a table on the schema.
func (SQL) SQLAddColumn ¶ added in v0.0.3
SQLAddColumn return the add column sql for table create
func (SQL) SQLAddIndex ¶ added in v0.0.3
SQLAddIndex return the add index sql for table create
func (SQL) SQLAddPrimary ¶ added in v0.0.3
SQLAddPrimary return the add primary key sql for table create
func (SQL) TableExists ¶ added in v0.0.3
TableExists check if the table exists
func (SQL) WhereBasic ¶ added in v0.5.1
WhereBasic Compile a date based where clause.
func (SQL) WhereBetween ¶ added in v0.5.1
WhereBetween Compile a "between" where clause.
func (SQL) WhereColumn ¶ added in v0.5.1
WhereColumn Compile a where clause comparing two columns.
func (SQL) WhereDateBased ¶ added in v0.5.1
func (grammarSQL SQL) WhereDateBased(typ string, query *dbal.Query, where dbal.Where, bindingOffset *int) string
WhereDateBased Compile a date based where clause.
func (SQL) WhereExists ¶ added in v0.5.1
WhereExists Compile a where (not) exists clause.
func (SQL) WhereMonth ¶ added in v0.5.1
WhereMonth Compile a "where month" clause.
func (SQL) WhereNested ¶ added in v0.5.1
WhereNested Compile a nested where clause.
func (SQL) WhereNotnull ¶ added in v0.5.1
WhereNotnull Compile a "where not null" clause.