Documentation ¶
Index ¶
- Variables
- func IsEmpty(c aspect.Clause) aspect.FuncClause
- func StringAgg(c aspect.ColumnElem, separator string) aspect.ColumnElem
- type AlterSeqStmt
- type ColumnElem
- func (c ColumnElem) ContainedBy(i interface{}) aspect.BinaryClause
- func (c ColumnElem) Contains(i interface{}) aspect.BinaryClause
- func (c ColumnElem) Difference(i interface{}) aspect.BinaryClause
- func (c ColumnElem) DoesNotExtendToTheLeftOf(i interface{}) aspect.BinaryClause
- func (c ColumnElem) DoesNotExtendToTheRightOf(i interface{}) aspect.BinaryClause
- func (c ColumnElem) GetJSON(name string) ColumnElem
- func (c ColumnElem) GetJSONText(name string) ColumnElem
- func (c ColumnElem) GreaterThan(i interface{}) aspect.BinaryClause
- func (c ColumnElem) GreaterThanOrEqual(i interface{}) aspect.BinaryClause
- func (c ColumnElem) Intersection(i interface{}) aspect.BinaryClause
- func (c ColumnElem) IsAdjacentTo(i interface{}) aspect.BinaryClause
- func (c ColumnElem) LessThan(i interface{}) aspect.BinaryClause
- func (c ColumnElem) LessThanOrEqual(i interface{}) aspect.BinaryClause
- func (c ColumnElem) NotEqual(i interface{}) aspect.BinaryClause
- func (c ColumnElem) Overlap(i interface{}) aspect.BinaryClause
- func (c ColumnElem) StrictlyLeftOf(i interface{}) aspect.BinaryClause
- func (c ColumnElem) StrictlyRightOf(i interface{}) aspect.BinaryClause
- func (c ColumnElem) Union(i interface{}) aspect.BinaryClause
- type DateRange
- type ExcludeConstraint
- type IndexMethod
- type Inet
- type JSON
- type Operator
- type PostGres
- type RetInsertStmt
- func (stmt RetInsertStmt) Compile(d aspect.Dialect, params *aspect.Parameters) (string, error)
- func (stmt RetInsertStmt) CompileColumns(d aspect.Dialect, params *aspect.Parameters, columns []aspect.ColumnElem) []string
- func (stmt RetInsertStmt) Returning(cs ...aspect.Selectable) RetInsertStmt
- func (stmt RetInsertStmt) String() string
- func (stmt RetInsertStmt) Values(args interface{}) RetInsertStmt
- type Sequence
- type Serial
- type UUID
- type WithClause
Constants ¶
This section is empty.
Variables ¶
var GenerateV4 string = `uuid_generate_v4()`
var Now string = `now() at time zone 'utc'`
Now represents the clause needed to return a now timestamp in postgres
Functions ¶
func StringAgg ¶ added in v0.5.2
func StringAgg(c aspect.ColumnElem, separator string) aspect.ColumnElem
Types ¶
type AlterSeqStmt ¶
type AlterSeqStmt struct {
// contains filtered or unexported fields
}
func AlterSequence ¶
func AlterSequence(sequence Sequence) (stmt AlterSeqStmt)
func (AlterSeqStmt) Compile ¶
func (stmt AlterSeqStmt) Compile(d aspect.Dialect, ps *aspect.Parameters) (string, error)
func (AlterSeqStmt) RenameTo ¶
func (stmt AlterSeqStmt) RenameTo(name string) AlterSeqStmt
func (AlterSeqStmt) RestartWith ¶
func (stmt AlterSeqStmt) RestartWith(n int) AlterSeqStmt
func (AlterSeqStmt) String ¶
func (stmt AlterSeqStmt) String() string
type ColumnElem ¶ added in v0.4.0
type ColumnElem struct {
aspect.ColumnElem
}
ColumnElem expands aspect's ColumnElem by adding PostGres specific operators and functions
func Column ¶ added in v0.4.0
func Column(column aspect.ColumnElem) ColumnElem
Column wraps an aspect ColumnElem and adds postgres specific functionality C wraps an aspect ColumnElem and adds postgres specific functionality
func (ColumnElem) ContainedBy ¶ added in v0.4.0
func (c ColumnElem) ContainedBy(i interface{}) aspect.BinaryClause
func (ColumnElem) Contains ¶ added in v0.4.0
func (c ColumnElem) Contains(i interface{}) aspect.BinaryClause
func (ColumnElem) Difference ¶ added in v0.4.0
func (c ColumnElem) Difference(i interface{}) aspect.BinaryClause
func (ColumnElem) DoesNotExtendToTheLeftOf ¶ added in v0.4.0
func (c ColumnElem) DoesNotExtendToTheLeftOf(i interface{}) aspect.BinaryClause
func (ColumnElem) DoesNotExtendToTheRightOf ¶ added in v0.4.0
func (c ColumnElem) DoesNotExtendToTheRightOf(i interface{}) aspect.BinaryClause
func (ColumnElem) GetJSON ¶ added in v0.5.3
func (c ColumnElem) GetJSON(name string) ColumnElem
func (ColumnElem) GetJSONText ¶ added in v0.5.3
func (c ColumnElem) GetJSONText(name string) ColumnElem
func (ColumnElem) GreaterThan ¶ added in v0.4.0
func (c ColumnElem) GreaterThan(i interface{}) aspect.BinaryClause
func (ColumnElem) GreaterThanOrEqual ¶ added in v0.4.0
func (c ColumnElem) GreaterThanOrEqual(i interface{}) aspect.BinaryClause
func (ColumnElem) Intersection ¶ added in v0.4.0
func (c ColumnElem) Intersection(i interface{}) aspect.BinaryClause
func (ColumnElem) IsAdjacentTo ¶ added in v0.4.0
func (c ColumnElem) IsAdjacentTo(i interface{}) aspect.BinaryClause
func (ColumnElem) LessThan ¶ added in v0.4.0
func (c ColumnElem) LessThan(i interface{}) aspect.BinaryClause
func (ColumnElem) LessThanOrEqual ¶ added in v0.4.0
func (c ColumnElem) LessThanOrEqual(i interface{}) aspect.BinaryClause
func (ColumnElem) NotEqual ¶ added in v0.4.0
func (c ColumnElem) NotEqual(i interface{}) aspect.BinaryClause
func (ColumnElem) Overlap ¶ added in v0.4.0
func (c ColumnElem) Overlap(i interface{}) aspect.BinaryClause
func (ColumnElem) StrictlyLeftOf ¶ added in v0.4.0
func (c ColumnElem) StrictlyLeftOf(i interface{}) aspect.BinaryClause
func (ColumnElem) StrictlyRightOf ¶ added in v0.4.0
func (c ColumnElem) StrictlyRightOf(i interface{}) aspect.BinaryClause
func (ColumnElem) Union ¶ added in v0.4.0
func (c ColumnElem) Union(i interface{}) aspect.BinaryClause
type DateRange ¶ added in v0.4.0
type DateRange struct{}
func (DateRange) IsPrimaryKey ¶ added in v0.4.0
func (DateRange) IsRequired ¶ added in v0.4.0
type ExcludeConstraint ¶ added in v0.4.0
type ExcludeConstraint struct {
// contains filtered or unexported fields
}
func Exclude ¶ added in v0.4.0
func Exclude(clauses ...WithClause) ExcludeConstraint
Exclude creates a new ExcludeConstraint
func (ExcludeConstraint) Create ¶ added in v0.4.0
func (exclude ExcludeConstraint) Create(d aspect.Dialect) (string, error)
Create returns the proper syntax for CREATE TABLE commands.
func (ExcludeConstraint) Modify ¶ added in v0.4.0
func (exclude ExcludeConstraint) Modify(table *aspect.TableElem) error
Modify adds the ExcludeConstraint to the table's creates
func (ExcludeConstraint) Using ¶ added in v0.4.0
func (exclude ExcludeConstraint) Using(method IndexMethod) ExcludeConstraint
Using sets the ExcludeConstraints index method
type IndexMethod ¶ added in v0.4.0
type IndexMethod string
const ( Gist IndexMethod = "gist" Gin IndexMethod = "gin" Btree IndexMethod = "btree" Hash IndexMethod = "hash" )
type Inet ¶
func (Inet) IsPrimaryKey ¶
func (Inet) IsRequired ¶
type JSON ¶ added in v0.3.0
func (JSON) IsPrimaryKey ¶ added in v0.3.0
func (JSON) IsRequired ¶ added in v0.3.0
type Operator ¶ added in v0.4.0
type Operator string
const ( Equal Operator = "=" NotEqual Operator = "<>" LessThan Operator = "<" GreaterThan Operator = ">" LessThanOrEqual Operator = "<=" GreaterThanOrEqual Operator = ">=" Contains Operator = "@>" ContainedBy Operator = "<@" Overlap Operator = "&&" StrictlyLeftOf Operator = "<<" StrictlyRightOf Operator = ">>" DoesNotExtendToTheRightOf Operator = "&<" DoesNotExtendToTheLeftOf Operator = "&>" IsAdjacentTo Operator = "-|-" Union Operator = "+" Intersection Operator = "*" Difference Operator = "-" )
func (Operator) With ¶ added in v0.4.0
func (op Operator) With(name string) WithClause
type PostGres ¶
type PostGres struct{}
PostGres implements the Dialect interface for postgres databases.
func (*PostGres) Parameterize ¶
Parameterize returns the postgres specific parameterization scheme.
type RetInsertStmt ¶
type RetInsertStmt struct { aspect.InsertStmt // contains filtered or unexported fields }
RetInsertStmt is the internal representation of an INSERT ... RETURNING statement.
func Insert ¶
func Insert(s aspect.Selectable, ss ...aspect.Selectable) RetInsertStmt
Insert creates an INSERT ... RETURNING statement for the given columns. There must be at least one column and all columns must belong to the same table.
func (RetInsertStmt) Compile ¶
func (stmt RetInsertStmt) Compile(d aspect.Dialect, params *aspect.Parameters) (string, error)
Compile outputs the INSERT ... RETURNING statement using the given dialect and parameters. An error may be returned because of a pre-existing error or because an error occurred during compilation.
func (RetInsertStmt) CompileColumns ¶
func (stmt RetInsertStmt) CompileColumns(d aspect.Dialect, params *aspect.Parameters, columns []aspect.ColumnElem) []string
TODO are errors required? TODO This should be a generalized function
func (RetInsertStmt) Returning ¶
func (stmt RetInsertStmt) Returning(cs ...aspect.Selectable) RetInsertStmt
Returning adds a RETURNING clause to the statement.
func (RetInsertStmt) String ¶
func (stmt RetInsertStmt) String() string
String outputs the parameter-less INSERT ... RETURNING statement in a neutral dialect.
func (RetInsertStmt) Values ¶
func (stmt RetInsertStmt) Values(args interface{}) RetInsertStmt
Values proxies to the inner InsertStmt's Values method
type WithClause ¶ added in v0.4.0
TODO Replace with a more robust binary clause?
func (WithClause) Compile ¶ added in v0.4.0
func (clause WithClause) Compile(d aspect.Dialect, params *aspect.Parameters) (string, error)
func (WithClause) String ¶ added in v0.4.0
func (clause WithClause) String() string