Documentation ¶
Index ¶
- Constants
- func CheckAllFieldNames(names []string, fields []*ResultField, flag uint32) error
- func CheckAmbiguousField(name string, fields []*ResultField, flag uint32) error
- func CheckFieldName(name string, fields []*ResultField, flag uint32) error
- func CheckFieldsEqual(xname, yname string) bool
- func CheckWildcardField(name string) (string, bool, error)
- func ContainAllFieldNames(names []string, fields []*ResultField, flag uint32) bool
- func ContainFieldName(name string, fields []*ResultField, flag uint32) bool
- func GetFieldIndex(name string, fields []*Field, flag uint32) []int
- func GetResultFieldIndex(name string, fields []*ResultField, flag uint32) []int
- func JoinQualifiedName(db string, table string, field string) string
- func RFQNames(l []*ResultField) []string
- type Field
- type Opt
- type ResultField
Constants ¶
const ( // DefaultFieldFlag is `FieldNameFlag`. DefaultFieldFlag = FieldNameFlag // CheckFieldFlag includes `FieldNameFlag` and `OrgFieldNameFlag`. CheckFieldFlag = FieldNameFlag | OrgFieldNameFlag )
const ( // OrgFieldNameFlag is origin filed name flag. OrgFieldNameFlag uint32 = 1 << iota // FieldNameFlag is filed name flag. FieldNameFlag )
Variables ¶
This section is empty.
Functions ¶
func CheckAllFieldNames ¶
func CheckAllFieldNames(names []string, fields []*ResultField, flag uint32) error
CheckAllFieldNames checks whether names has unknown or ambiguous field in ResultFields.
func CheckAmbiguousField ¶
func CheckAmbiguousField(name string, fields []*ResultField, flag uint32) error
CheckAmbiguousField checks whether name is an ambiguous field in ResultFields.
func CheckFieldName ¶
func CheckFieldName(name string, fields []*ResultField, flag uint32) error
CheckFieldName checks whether name is an unknown or ambiguous field in ResultFields.
func CheckFieldsEqual ¶
CheckFieldsEqual checks if xname and yname is equal. xname/yname in the pattern dbname.tablename.fieldname If any part of any argument is missing, it will ignore it and continue check other parts. So a.b.c equals b.c
func CheckWildcardField ¶
CheckWildcardField checks wildcard field, like `*` or `table.*` or `db.table.*`.
func ContainAllFieldNames ¶
func ContainAllFieldNames(names []string, fields []*ResultField, flag uint32) bool
ContainAllFieldNames checks whether names are all in ResultFields. TODO: add alias table name support
func ContainFieldName ¶
func ContainFieldName(name string, fields []*ResultField, flag uint32) bool
ContainFieldName checks whether name is in ResultFields.
func GetFieldIndex ¶
GetFieldIndex gets name index in Fields.
func GetResultFieldIndex ¶
func GetResultFieldIndex(name string, fields []*ResultField, flag uint32) []int
GetResultFieldIndex gets name index in ResultFields.
func JoinQualifiedName ¶
JoinQualifiedName converts db, table, field to a qualified name.
Types ¶
type Field ¶
type Field struct { Expr expression.Expression Name string }
Field is used for parsing column name from SQL.
type ResultField ¶
type ResultField struct { column.Col // Col.Name is OrgName. Name string TableName string OrgTableName string DBName string }
ResultField provides meta data of table column.
func CloneFieldByName ¶
func CloneFieldByName(name string, fields []*ResultField, flag uint32) (*ResultField, error)
CloneFieldByName clones a ResultField in ResultFields according to name.
func ColToResultField ¶
func ColToResultField(col *column.Col, tableName string) *ResultField
ColToResultField converts Col to ResultField.
func ColsToResultFields ¶
func ColsToResultFields(cols []*column.Col, tableName string) []*ResultField
ColsToResultFields converts Cols to ResultFields.
func (*ResultField) Clone ¶
func (rf *ResultField) Clone() *ResultField
Clone clones a new ResultField from old ResultField.
func (*ResultField) String ¶
func (rf *ResultField) String() string
String implements fmt.Stringer interface.