Documentation
¶
Index ¶
- Variables
- type Config
- type ParsedFields
- func (f *ParsedFields) AddTable(tableName, as string)
- func (f *ParsedFields) AddTableField(area parsedFieldsArea, tableName, fieldName string)
- func (f *ParsedFields) Equal(other *ParsedFields) bool
- func (f *ParsedFields) MapDefaultTableName(fieldMap map[string][]string)
- func (f *ParsedFields) MergeAliasTables()
- func (f *ParsedFields) PurgeEmptyTables()
- type Parser
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrSQLStringEmpty = errors.New("SQL string is empty") ErrParserNotReady = errors.New("Parser is not ready. Call New() to create a new parser") )
Functions ¶
This section is empty.
Types ¶
type ParsedFields ¶
type ParsedFields struct { // FromFields is a map of all references to table names and their fields from the FROM clause (includes JOINs) FromFields map[string][]string // WhereFields is a map of all references to table names and their fields from the WHERE clause WhereFields map[string][]string // GroupByFields is a map of all references to table names and their fields from the GROUP BY clause GroupByFields map[string][]string // TableFields is a map of all references to table names and their fields TableFields map[string][]string // AliasMap is a map of table aliases to table names AliasMap map[string]string // DefaultTableName is the default table name fields are mapped to use when no table name is specified. We're using the first aliased table definition to set this DefaultTableName string // contains filtered or unexported fields }
func (*ParsedFields) AddTable ¶
func (f *ParsedFields) AddTable(tableName, as string)
AddTable adds a table to the list of tables, with an optional alias
func (*ParsedFields) AddTableField ¶
func (f *ParsedFields) AddTableField(area parsedFieldsArea, tableName, fieldName string)
AddTableField adds a field to the list of fields for a table in a specific area
func (*ParsedFields) Equal ¶
func (f *ParsedFields) Equal(other *ParsedFields) bool
Equal compares this ParsedFields to another and returns true if they are equal. Order of fields is not considered
func (*ParsedFields) MapDefaultTableName ¶
func (f *ParsedFields) MapDefaultTableName(fieldMap map[string][]string)
MapDefaultTableName maps empty table names to the default table name
func (*ParsedFields) MergeAliasTables ¶
func (f *ParsedFields) MergeAliasTables()
MergeAliasTables merges the table names where an alias is used
func (*ParsedFields) PurgeEmptyTables ¶
func (f *ParsedFields) PurgeEmptyTables()
PurgeEmptyTables removes any tables that have no fields
Click to show internal directories.
Click to hide internal directories.