Documentation
¶
Index ¶
- type And
- type Case
- type Formatter
- type From
- type Function
- type Generic
- type GroupBy
- type Having
- type Insert
- type Join
- type Limit
- type Lock
- type Options
- type Or
- type OrderBy
- type Parenthesis
- type Returning
- type Select
- type Set
- type Subquery
- type TieGroup
- type Token
- func (formatter Token) AddIndent(lev int)
- func (formatter Token) ContinueLine() bool
- func (formatter Token) ContinueNewline() bool
- func (formatter Token) Format(buf *bytes.Buffer, parent []Formatter, parentIdx int) error
- func (formatter Token) IsComparator() bool
- func (formatter Token) IsJoinStart() bool
- func (formatter Token) IsLimitClauseStart() bool
- func (formatter Token) IsTieClauseStart() bool
- type Type
- type Values
- type Where
- type With
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type And ¶
type And struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
SameLine bool
}
And formatter
type Case ¶
type Case struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
}
Case group formatter
type Formatter ¶
type Formatter interface {
Format(buf *bytes.Buffer, parent []Formatter, parentIdx int) error
AddIndent(lev int)
}
Formatter interface. Example values of Formatter would be clause group or token
type From ¶
type From struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
}
From group formatter
type Function ¶
type Function struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
IsColumnArea bool
}
Function group formatter
type Generic ¶
type Generic struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
}
Generic group formatter The generic group formatter can be applied if no special formatting rules are required
type GroupBy ¶
type GroupBy struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
}
GroupBy group formatter
type Having ¶
type Having struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
}
Having group formatter
type Insert ¶
type Insert struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
}
Insert group formatter
type Join ¶
type Join struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
}
Join group formatter
type Limit ¶
type Limit struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
}
Limit group formatter Limit such as LIMIT, OFFSET, FETCH FIRST
type Lock ¶
type Lock struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
}
Lock group formatter
type Options ¶
type Options struct {
Padding string // Character sequence added as left padding on all lines, e.g. "" (none)
Indent string // Character sequence used left indentation on indented clauses, e.g. " " (4 spaces)
Newline string // Character sequence used as line feeds, e.g. "\n" (newline character)
Whitespace string // Character sequence used as whitespace in SQL string, e.g. " " (single space)
Dialect lexer.Dialect // SQL dialect for formatting rules
}
Options to define output format of Formatters
func DefaultOptions ¶
func DefaultOptions() *Options
DefaultOptions returns a default options set for Formatters. Also used in unit tests.
type Or ¶
type Or struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
SameLine bool
}
Or formatter
type OrderBy ¶
type OrderBy struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
}
OrderBy group formatter
type Parenthesis ¶
type Parenthesis struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
IsColumnArea bool
PositionInParent int
}
Parenthesis group formatter
func (*Parenthesis) AddIndent ¶
func (formatter *Parenthesis) AddIndent(lev int)
AddIndent increments indentation level by the given amount
type Returning ¶
type Returning struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
}
Returning group formatter
type Select ¶
type Select struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
}
Select group formatter
type Set ¶
type Set struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
}
Set group formatter
type Subquery ¶
type Subquery struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
IsColumnArea bool
}
Subquery formatters
type TieGroup ¶
type TieGroup struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
}
TieGroup group formatter TieGroup such as UNION, EXCEPT, INTERSECT
type Token ¶
Token wrapping lexer Token but extended with Options struct
func (Token) ContinueLine ¶
ContinueLine should be called on the last parent token to see, if a token should continue in the same line
func (Token) ContinueNewline ¶
ContinueNewline returns true if a token should be moved to a new line
func (Token) IsComparator ¶
IsComparator returns true if token is a comparator
func (Token) IsJoinStart ¶
IsJoinStart determines if token type is included in TokenTypesOfJoinMaker
func (Token) IsLimitClauseStart ¶
IsLimitClauseStart determines token type is included in TokenTypesOfLimitClause
func (Token) IsTieClauseStart ¶
IsTieClauseStart determines if token type is included in TokenTypesOfTieClause
type Type ¶
type Type struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
}
Type group formatter
type Values ¶
type Values struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
}
Values group formatter
type Where ¶
type Where struct {
Elements []Formatter
IndentLevel int
*Options // Options used later to format element
}
Where group formatter