Documentation
¶
Index ¶
- type ArithOperator
- type ComparisonOperator
- type Expr
- type FuncName
- type Record
- type Select
- type Type
- type Value
- func (value *Value) ArrayValue() []*Value
- func (value *Value) BoolValue() bool
- func (value *Value) CSVString() string
- func (value *Value) FloatValue() float64
- func (value *Value) IntValue() int64
- func (value *Value) MarshalJSON() ([]byte, error)
- func (value *Value) NullValue() *struct{}
- func (value *Value) String() string
- func (value *Value) StringValue() string
- func (value *Value) TimeValue() time.Time
- func (value *Value) Type() Type
- func (value *Value) Value() interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArithOperator ¶
type ArithOperator string
ArithOperator - arithmetic operator.
const ( // Add operator '+'. Add ArithOperator = "+" // Subtract operator '-'. Subtract ArithOperator = "-" // Multiply operator '*'. Multiply ArithOperator = "*" // Divide operator '/'. Divide ArithOperator = "/" // Modulo operator '%'. Modulo ArithOperator = "%" )
type ComparisonOperator ¶
type ComparisonOperator string
ComparisonOperator - comparison operator.
const ( // Equal operator '='. Equal ComparisonOperator = "=" // NotEqual operator '!=' or '<>'. NotEqual ComparisonOperator = "!=" // LessThan operator '<'. LessThan ComparisonOperator = "<" // GreaterThan operator '>'. GreaterThan ComparisonOperator = ">" // LessThanEqual operator '<='. LessThanEqual ComparisonOperator = "<=" // GreaterThanEqual operator '>='. GreaterThanEqual ComparisonOperator = ">=" // Between operator 'BETWEEN' Between ComparisonOperator = "between" // In operator 'IN' In ComparisonOperator = "in" // Like operator 'LIKE' Like ComparisonOperator = "like" // NotBetween operator 'NOT BETWEEN' NotBetween ComparisonOperator = "not between" // NotIn operator 'NOT IN' NotIn ComparisonOperator = "not in" // NotLike operator 'NOT LIKE' NotLike ComparisonOperator = "not like" // IsNull operator 'IS NULL' IsNull ComparisonOperator = "is null" // IsNotNull operator 'IS NOT NULL' IsNotNull ComparisonOperator = "is not null" )
func (ComparisonOperator) String ¶
func (operator ComparisonOperator) String() string
String - returns string representation of this operator.
type Expr ¶
type Expr interface {
AggregateValue() (*Value, error)
Eval(record Record) (*Value, error)
ReturnType() Type
Type() Type
}
Expr - a SQL expression type.
type FuncName ¶
type FuncName string
FuncName - SQL function name.
const ( // Avg - aggregate SQL function AVG(). Avg FuncName = "AVG" // Count - aggregate SQL function COUNT(). Count FuncName = "COUNT" // Max - aggregate SQL function MAX(). Max FuncName = "MAX" // Min - aggregate SQL function MIN(). Min FuncName = "MIN" // Sum - aggregate SQL function SUM(). Sum FuncName = "SUM" // Coalesce - conditional SQL function COALESCE(). Coalesce FuncName = "COALESCE" // NullIf - conditional SQL function NULLIF(). NullIf FuncName = "NULLIF" // ToTimestamp - conversion SQL function TO_TIMESTAMP(). ToTimestamp FuncName = "TO_TIMESTAMP" // UTCNow - date SQL function UTCNOW(). UTCNow FuncName = "UTCNOW" // CharLength - string SQL function CHAR_LENGTH(). CharLength FuncName = "CHAR_LENGTH" // CharacterLength - string SQL function CHARACTER_LENGTH() same as CHAR_LENGTH(). CharacterLength FuncName = "CHARACTER_LENGTH" // Lower - string SQL function LOWER(). Lower FuncName = "LOWER" // Substring - string SQL function SUBSTRING(). Substring FuncName = "SUBSTRING" // Trim - string SQL function TRIM(). Trim FuncName = "TRIM" // Upper - string SQL function UPPER(). Upper FuncName = "UPPER" )
type Record ¶
type Record interface {
Get(name string) (*Value, error)
Set(name string, value *Value) error
MarshalCSV(fieldDelimiter rune) ([]byte, error)
MarshalJSON() ([]byte, error)
}
Record - is a type containing columns and their values.
type Select ¶
type Select struct {
// contains filtered or unexported fields
}
Select - SQL Select statement.
func (*Select) AggregateResult ¶
AggregateResult - returns aggregate result as record.
func (*Select) IsAggregated ¶
IsAggregated - returns whether aggregated functions are used in select expression or not.
func (*Select) IsSelectAll ¶
IsSelectAll - returns whether '*' is used in select expression or not.
func (*Select) TableAlias ¶
TableAlias - returns table alias name.
type Type ¶
type Type string
Type - value type.
const ( // Null - represents NULL value type. Null Type = "null" // Bool - represents boolean value type. Bool Type = "bool" // Int - represents integer value type. Int Type = "int" // Float - represents floating point value type. Float Type = "float" // String - represents string value type. String Type = "string" // Timestamp - represents time value type. Timestamp Type = "timestamp" // Array - represents array of values where each value type is one of above. Array Type = "array" )
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value - represents any primitive value of bool, int, float, string and time.
func (*Value) ArrayValue ¶
ArrayValue - returns underlying value array. It panics if value is not Array type.
func (*Value) BoolValue ¶
BoolValue - returns underlying bool value. It panics if value is not Bool type.
func (*Value) FloatValue ¶
FloatValue - returns underlying int/float value as float64. It panics if value is not Int/Float type.
func (*Value) IntValue ¶
IntValue - returns underlying int value. It panics if value is not Int type.
func (*Value) MarshalJSON ¶
MarshalJSON - encodes to JSON data.
func (*Value) NullValue ¶
func (value *Value) NullValue() *struct{}
NullValue - returns underlying null value. It panics if value is not null type.
func (*Value) StringValue ¶
StringValue - returns underlying string value. It panics if value is not String type.