Documentation
¶
Index ¶
- func NewAliasedTable(name TableName, alias TableAlias) aliasedTable
- func NewBuilder() *builder
- func NewBuilderWithOffset(pc *int) *builder
- func NewTable(name TableName) aliasedTable
- type Builder
- type CondInterpreter
- type ConditionSerializable
- type Field
- type FieldName
- type JoinedTable
- type PagInterpreter
- type Param
- type Serializable
- type Table
- type TableAlias
- type TableName
- type Tuple
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAliasedTable ¶
func NewAliasedTable(name TableName, alias TableAlias) aliasedTable
func NewBuilder ¶
func NewBuilder() *builder
func NewBuilderWithOffset ¶
func NewBuilderWithOffset(pc *int) *builder
Types ¶
type Builder ¶
type Builder interface {
WriteParam(Param) Builder
WriteTuples([]Tuple) Builder
WriteString(string) Builder
WriteRune(rune) Builder
WriteSerializables(...Serializable) Builder
WriteConditionSerializable(ConditionSerializable, CondInterpreter) Builder
Build() (string, []Param)
}
Builder is the string builder
type CondInterpreter ¶
type CondInterpreter interface {
// TimeOffset appends NOW() - '10 seconds'
TimeOffset(duration time.Duration, sb Builder)
// InTuple creates the condition (field1, field2, ...) IN ((val1, val2, ...), (val3, val4, ...))
InTuple(fields []Serializable, vals []Tuple, sb Builder)
}
CondInterpreter is the condition interpreter for the WHERE clauses It specifies the behaviors that differ among different DBs
type ConditionSerializable ¶
type ConditionSerializable interface {
WriteString(CondInterpreter, Builder)
}
ConditionSerializable is any type that can be transformed to a query part but needs condition interpreter support, e.g. condition, join
type Field ¶
type Field Serializable
type FieldName ¶
type FieldName string
FieldName is the name of the DB column
func (FieldName) WriteString ¶
type JoinedTable ¶
type JoinedTable interface {
ConditionSerializable
Join(Table, ConditionSerializable) JoinedTable
}
type PagInterpreter ¶
type PagInterpreter interface {
// Interpret modifies the SQL query to add pagination support
Interpret(p driver.Pagination, sb Builder)
}
PagInterpreter is the pagination interpreter
type Serializable ¶
type Serializable interface {
WriteString(Builder)
}
Serializable is any type can be transformed to a query part, e.g. field, order-by
func ToSerializables ¶
func ToSerializables[S Serializable](vs []S) []Serializable
type Table ¶
type Table interface {
JoinedTable
Field(name FieldName) Field
}
type TableAlias ¶
type TableAlias string
Click to show internal directories.
Click to hide internal directories.