Documentation
¶
Index ¶
- func DeleteSQL(ir_del *ir.Delete, dialect Dialect) sqlgen.SQL
- func ExprSQL(expr *ir.Expr, dialect Dialect) sqlgen.SQL
- func InsertSQL(ir_cre *ir.Create, dialect Dialect) sqlgen.SQL
- func SQLFromGroupBy(group_by *GroupBy) sqlgen.SQL
- func SQLFromInsert(insert *Insert) sqlgen.SQL
- func SQLFromJoin(join Join) sqlgen.SQL
- func SQLFromJoins(joins []Join) []sqlgen.SQL
- func SQLFromOrderBy(order_by *OrderBy) sqlgen.SQL
- func SQLFromSchema(schema *Schema) []sqlgen.SQL
- func SQLFromSelect(sel *Select) sqlgen.SQL
- func SQLFromUpdate(upd *Update) sqlgen.SQL
- func SchemaCreateSQL(ir_root *ir.Root, dialect Dialect) []sqlgen.SQL
- func SchemaDropSQL(ir_root *ir.Root, dialect Dialect) []sqlgen.SQL
- func SelectSQL(ir_read *ir.Read, dialect Dialect) sqlgen.SQL
- func UpdateSQL(ir_upd *ir.Update, dialect Dialect) sqlgen.SQL
- func WhereSQL(wheres []*ir.Where, dialect Dialect) (out []sqlgen.SQL)
- type Column
- type DefaultDialect
- type Dialect
- type Features
- type GroupBy
- type Index
- type Insert
- type Join
- type OrderBy
- type OrderByEntry
- type Reference
- type ReplaceStyle
- type Schema
- type Select
- type Table
- type Update
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SQLFromGroupBy ¶
func SQLFromInsert ¶
func SQLFromJoin ¶
func SQLFromJoins ¶
func SQLFromOrderBy ¶
func SQLFromSchema ¶
func SQLFromSelect ¶
func SQLFromUpdate ¶
Types ¶
type DefaultDialect ¶
type DefaultDialect struct{}
DefaultDialect can be used to make forward compatible Dialects with default implementations for new methods.
func (DefaultDialect) CreateSchema ¶
func (d DefaultDialect) CreateSchema(schema *Schema) (res []sqlgen.SQL)
CreateSchema implements Dialect.
func (DefaultDialect) DropSchema ¶
func (d DefaultDialect) DropSchema(schema *Schema) (res []sqlgen.SQL)
DropSchema implements Dialect.
func (DefaultDialect) ReturningLit ¶
func (d DefaultDialect) ReturningLit() string
func (DefaultDialect) SupportDefaultValues ¶
func (d DefaultDialect) SupportDefaultValues() bool
SupportDefaultValues implements Dialect.
type Dialect ¶
type Dialect interface {
Name() string
Features() Features
RowId() string
ColumnType(field *ir.Field) string
Rebind(sql string) string
EscapeString(s string) string
BoolLit(v bool) string
DefaultLit(v string) string
// ReturningLit returns with literal to be used for returning values from an insert.
ReturningLit() string
// CreateSchema generates SQL from abstract schema to create all the required tables/indexes.
CreateSchema(schema *Schema) []sqlgen.SQL
// DropSchema drops all the resources from the schema. Useful for testing.
DropSchema(schema *Schema) []sqlgen.SQL
}
func PGXCockroach ¶
func PGXCockroach() Dialect
type Features ¶
type Features struct {
// Supports DEFAULT VALUES in INSERT statement
DefaultValues bool
// Supports comparing tuples, such as (a, b) < (c, d)
TupleComparsion bool
// Supports positional argument placeholders
PositionalArguments bool
// Token used with LIMIT to mean "no limit"
NoLimitToken string
// What style the database uses to handle replacement creates
ReplaceStyle ReplaceStyle
// Supports the STORING feature of indexes
Storing bool
}
type Insert ¶
type Insert struct {
Table string
PrimaryKey []string
// StaticColumns are column names without defaults, requested to be inserted
StaticColumns []string
// DynamicColumns are column names with defaults, requested to be inserted
DynamicColumns []string
// AllDefaults are all the available non-ref columns (even if they are not requested as insert parameters).
AllDefaults []string
Returning []string
ReplaceStyle *ReplaceStyle
// SupportDefaultValues should be true, if `INSERT INTO .... DEFAULT VALUES` is supported
SupportDefaultValues bool
ReturningLit string
}
type OrderByEntry ¶
type ReplaceStyle ¶
type ReplaceStyle int
const ( ReplaceStyle_Replace ReplaceStyle = iota ReplaceStyle_OnConflictUpdate ReplaceStyle_Upsert ReplaceStyle_Upsert_Spanner )
type Select ¶
Click to show internal directories.
Click to hide internal directories.