Documentation ¶
Overview ¶
Package types defines some internal types that are handled by the "builder" and "stmt" package.
RawContext, StdContext and NamedContext are used to generate queries.
Index ¶
Constants ¶
const ( // InnerJoin has a "INNER JOIN" type. InnerJoin = JoinType("INNER JOIN") // LeftJoin has a "LEFT JOIN" type. LeftJoin = JoinType("LEFT JOIN") // RightJoin has a "RIGHT JOIN" type. RightJoin = JoinType("RIGHT JOIN") // LeftOuterJoin has a "LEFT OUTER JOIN" type. LeftOuterJoin = JoinType("LEFT OUTER JOIN") // RightOuterJoin has a "RIGHT OUTER JOIN" type. RightOuterJoin = JoinType("RIGHT OUTER JOIN") )
Join types.
const ( And = LogicalOperator("AND") Or = LogicalOperator("OR") Not = LogicalOperator("NOT") )
Logical operators.
const ( Equal = ComparisonOperator("=") NotEqual = ComparisonOperator("!=") Is = ComparisonOperator("IS") IsNot = ComparisonOperator("IS NOT") GreaterThan = ComparisonOperator(">") GreaterThanOrEqual = ComparisonOperator(">=") LessThan = ComparisonOperator("<") LessThanOrEqual = ComparisonOperator("<=") In = ComparisonOperator("IN") NotIn = ComparisonOperator("NOT IN") Like = ComparisonOperator("LIKE") NotLike = ComparisonOperator("NOT LIKE") ILike = ComparisonOperator("ILIKE") NotILike = ComparisonOperator("NOT ILIKE") Between = ComparisonOperator("BETWEEN") NotBetween = ComparisonOperator("NOT BETWEEN") )
Comparison operators.
const ( // Asc indicates forward order. Asc = OrderType("ASC") // Desc indicates reverse order. Desc = OrderType("DESC") )
Order types.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComparisonOperator ¶
type ComparisonOperator string
ComparisonOperator represents a comparison operator.
func (ComparisonOperator) String ¶
func (e ComparisonOperator) String() string
type Context ¶
type Context interface { Write(query string) Bind(value interface{}) }
A Context is passed to a root stmt.Statement to generate a query.
type LogicalOperator ¶
type LogicalOperator string
LogicalOperator represents a logical operator.
func (LogicalOperator) String ¶
func (e LogicalOperator) String() string
type NamedContext ¶
type NamedContext struct { RawContext // contains filtered or unexported fields }
NamedContext uses named query placeholders.
func (*NamedContext) Bind ¶
func (ctx *NamedContext) Bind(value interface{})
Bind adds given value in context's values.
func (*NamedContext) Values ¶
func (ctx *NamedContext) Values() map[string]interface{}
Values returns the named argument values.
type RawContext ¶
type RawContext struct {
// contains filtered or unexported fields
}
RawContext embeds values directly in the query.
func (*RawContext) Bind ¶
func (ctx *RawContext) Bind(value interface{})
Bind adds given value in context's values.
func (*RawContext) Query ¶
func (ctx *RawContext) Query() string
Query returns the underlaying query.
func (*RawContext) Write ¶
func (ctx *RawContext) Write(query string)
Write appends given subquery in context's buffer.
type StdContext ¶
type StdContext struct { RawContext // contains filtered or unexported fields }
StdContext uses positional query placeholders.
func (*StdContext) Bind ¶
func (ctx *StdContext) Bind(value interface{})
Bind adds given value in context's values.
func (*StdContext) Values ¶
func (ctx *StdContext) Values() []interface{}
Values returns the positional argument values.