Documentation ¶
Index ¶
- Constants
- Variables
- func CompareDataRowColumns(leftRow, rightRow *DataRow, columnIndex int, exactMatch bool) (int, error)
- func ExpressionValueTypeLen() int
- func SelectSignalIDSet(dataSet *DataSet, filterExpression string, primaryTable string, ...) (guid.HashSet, error)
- func SelectSignalIDSetFromTable(dataTable *DataTable, filterExpression string, primaryTable string, ...) (guid.HashSet, error)
- type CallbackErrorListener
- type ColumnExpression
- type DataColumn
- type DataRow
- func (dr *DataRow) BooleanValue(columnIndex int) (bool, bool, error)
- func (dr *DataRow) BooleanValueByName(columnName string) (bool, bool, error)
- func (dr *DataRow) ColumnValueAsString(column *DataColumn) string
- func (dr *DataRow) DateTimeValue(columnIndex int) (time.Time, bool, error)
- func (dr *DataRow) DateTimeValueByName(columnName string) (time.Time, bool, error)
- func (dr *DataRow) DecimalValue(columnIndex int) (decimal.Decimal, bool, error)
- func (dr *DataRow) DecimalValueByName(columnName string) (decimal.Decimal, bool, error)
- func (dr *DataRow) DoubleValue(columnIndex int) (float64, bool, error)
- func (dr *DataRow) DoubleValueByName(columnName string) (float64, bool, error)
- func (dr *DataRow) GuidValue(columnIndex int) (guid.Guid, bool, error)
- func (dr *DataRow) GuidValueByName(columnName string) (guid.Guid, bool, error)
- func (dr *DataRow) Int16Value(columnIndex int) (int16, bool, error)
- func (dr *DataRow) Int16ValueByName(columnName string) (int16, bool, error)
- func (dr *DataRow) Int32Value(columnIndex int) (int32, bool, error)
- func (dr *DataRow) Int32ValueByName(columnName string) (int32, bool, error)
- func (dr *DataRow) Int64Value(columnIndex int) (int64, bool, error)
- func (dr *DataRow) Int64ValueByName(columnName string) (int64, bool, error)
- func (dr *DataRow) Int8Value(columnIndex int) (int8, bool, error)
- func (dr *DataRow) Int8ValueByName(columnName string) (int8, bool, error)
- func (dr *DataRow) Parent() *DataTable
- func (dr *DataRow) SetValue(columnIndex int, value interface{}) error
- func (dr *DataRow) SetValueByName(columnName string, value interface{}) error
- func (dr *DataRow) SingleValue(columnIndex int) (float32, bool, error)
- func (dr *DataRow) SingleValueByName(columnName string) (float32, bool, error)
- func (dr *DataRow) String() string
- func (dr *DataRow) StringValue(columnIndex int) (string, bool, error)
- func (dr *DataRow) StringValueByName(columnName string) (string, bool, error)
- func (dr *DataRow) UInt16Value(columnIndex int) (uint16, bool, error)
- func (dr *DataRow) UInt16ValueByName(columnName string) (uint16, bool, error)
- func (dr *DataRow) UInt32Value(columnIndex int) (uint32, bool, error)
- func (dr *DataRow) UInt32ValueByName(columnName string) (uint32, bool, error)
- func (dr *DataRow) UInt64Value(columnIndex int) (uint64, bool, error)
- func (dr *DataRow) UInt64ValueByName(columnName string) (uint64, bool, error)
- func (dr *DataRow) UInt8Value(columnIndex int) (uint8, bool, error)
- func (dr *DataRow) UInt8ValueByName(columnName string) (uint8, bool, error)
- func (dr *DataRow) Value(columnIndex int) (interface{}, error)
- func (dr *DataRow) ValueAsString(columnIndex int) string
- func (dr *DataRow) ValueAsStringByName(columnName string) string
- func (dr *DataRow) ValueByName(columnName string) (interface{}, error)
- type DataRowHashSet
- func NewDataRowHashSet(items []*DataRow) DataRowHashSet
- func SelectDataRowSet(dataSet *DataSet, filterExpression string, primaryTable string, ...) (DataRowHashSet, error)
- func SelectDataRowSetFromTable(dataTable *DataTable, filterExpression string, tableIDFields *TableIDFields, ...) (DataRowHashSet, error)
- func (hs DataRowHashSet) Add(item *DataRow) bool
- func (hs DataRowHashSet) Clear()
- func (hs DataRowHashSet) Contains(item *DataRow) bool
- func (hs DataRowHashSet) ExceptWith(other []*DataRow)
- func (hs DataRowHashSet) ExceptWithSet(other DataRowHashSet)
- func (hs DataRowHashSet) IntersectWith(other []*DataRow)
- func (hs DataRowHashSet) IntersectWithSet(other DataRowHashSet)
- func (hs DataRowHashSet) IsEmpty() bool
- func (hs DataRowHashSet) IsProperSubsetOf(other []*DataRow) bool
- func (hs DataRowHashSet) IsProperSubsetOfSet(other DataRowHashSet) bool
- func (hs DataRowHashSet) IsProperSupersetOf(other []*DataRow) bool
- func (hs DataRowHashSet) IsProperSupersetOfSet(other DataRowHashSet) bool
- func (hs DataRowHashSet) IsSubsetOf(other []*DataRow) bool
- func (hs DataRowHashSet) IsSubsetOfSet(other DataRowHashSet) bool
- func (hs DataRowHashSet) IsSupersetOf(other []*DataRow) bool
- func (hs DataRowHashSet) IsSupersetOfSet(other DataRowHashSet) bool
- func (hs DataRowHashSet) Keys() []*DataRow
- func (hs DataRowHashSet) Overlaps(other []*DataRow) bool
- func (hs DataRowHashSet) OverlapsSet(other DataRowHashSet) bool
- func (hs DataRowHashSet) Remove(item *DataRow) bool
- func (hs DataRowHashSet) RemoveWhere(predicate func(*DataRow) bool) int
- func (hs DataRowHashSet) SetEquals(other []*DataRow) bool
- func (hs DataRowHashSet) SetEqualsSet(other DataRowHashSet) bool
- func (hs DataRowHashSet) SymmetricExceptWith(other []*DataRow)
- func (hs DataRowHashSet) SymmetricExceptWithSet(other DataRowHashSet)
- func (hs DataRowHashSet) UnionWith(other []*DataRow)
- func (hs DataRowHashSet) UnionWithSet(other DataRowHashSet)
- type DataSet
- func (ds *DataSet) AddTable(table *DataTable)
- func (ds *DataSet) CreateTable(name string) *DataTable
- func (ds *DataSet) ParseXml(data []byte) error
- func (ds *DataSet) ParseXmlDocument(doc *xml.XmlDocument) error
- func (ds *DataSet) RemoveTable(tableName string) bool
- func (ds *DataSet) String() string
- func (ds *DataSet) Table(tableName string) *DataTable
- func (ds *DataSet) TableCount() int
- func (ds *DataSet) TableNames() []string
- func (ds *DataSet) Tables() []*DataTable
- type DataTable
- func (dt *DataTable) AddColumn(column *DataColumn)
- func (dt *DataTable) AddRow(row *DataRow)
- func (dt *DataTable) CloneColumn(source *DataColumn) *DataColumn
- func (dt *DataTable) CloneRow(source *DataRow) *DataRow
- func (dt *DataTable) Column(columnIndex int) *DataColumn
- func (dt *DataTable) ColumnByName(columnName string) *DataColumn
- func (dt *DataTable) ColumnCount() int
- func (dt *DataTable) ColumnIndex(columnName string) int
- func (dt *DataTable) CreateColumn(name string, dataType DataTypeEnum, expression string) *DataColumn
- func (dt *DataTable) CreateRow() *DataRow
- func (dt *DataTable) InitColumns(length int)
- func (dt *DataTable) InitRows(length int)
- func (dt *DataTable) Name() string
- func (dt *DataTable) Parent() *DataSet
- func (dt *DataTable) Row(rowIndex int) *DataRow
- func (dt *DataTable) RowCount() int
- func (dt *DataTable) RowValueAsString(rowIndex, columnIndex int) string
- func (dt *DataTable) RowValueAsStringByName(rowIndex int, columnName string) string
- func (dt *DataTable) RowsWhere(predicate func(*DataRow) bool, limit int) []*DataRow
- func (dt *DataTable) Select(filterExpression string, sortOrder string, limit int) ([]*DataRow, error)
- func (dt *DataTable) String() string
- type DataTypeEnum
- type Expression
- type ExpressionFunctionTypeEnum
- type ExpressionOperatorTypeEnum
- type ExpressionTree
- func GenerateExpressionTree(dataTable *DataTable, filterExpression string, suppressConsoleErrorOutput bool) (*ExpressionTree, error)
- func GenerateExpressionTrees(dataSet *DataSet, primaryTable string, filterExpression string, ...) ([]*ExpressionTree, error)
- func GenerateExpressionTreesFromTable(dataTable *DataTable, filterExpression string, suppressConsoleErrorOutput bool) ([]*ExpressionTree, error)
- func NewExpressionTree() *ExpressionTree
- type ExpressionTypeEnum
- type ExpressionUnaryTypeEnum
- type ExpressionValueTypeEnum
- type FilterExpressionParser
- func (fep *FilterExpressionParser) EnterExpression(*parser.ExpressionContext)
- func (fep *FilterExpressionParser) EnterFilterExpressionStatement(context *parser.FilterExpressionStatementContext)
- func (fep *FilterExpressionParser) EnterFilterStatement(context *parser.FilterStatementContext)
- func (fep *FilterExpressionParser) Evaluate(applyLimit bool, applySort bool) error
- func (fep *FilterExpressionParser) ExitColumnName(context *parser.ColumnNameContext)
- func (fep *FilterExpressionParser) ExitExpression(context *parser.ExpressionContext)
- func (fep *FilterExpressionParser) ExitFunctionExpression(context *parser.FunctionExpressionContext)
- func (fep *FilterExpressionParser) ExitIdentifierStatement(context *parser.IdentifierStatementContext)
- func (fep *FilterExpressionParser) ExitLiteralValue(context *parser.LiteralValueContext)
- func (fep *FilterExpressionParser) ExitPredicateExpression(context *parser.PredicateExpressionContext)
- func (fep *FilterExpressionParser) ExitValueExpression(context *parser.ValueExpressionContext)
- func (fep *FilterExpressionParser) ExpressionTrees() ([]*ExpressionTree, error)
- func (fep *FilterExpressionParser) FilterExpressionStatementCount() int
- func (fep *FilterExpressionParser) FilteredRowSet() DataRowHashSet
- func (fep *FilterExpressionParser) FilteredRows() []*DataRow
- func (fep *FilterExpressionParser) FilteredSignalIDSet() guid.HashSet
- func (fep *FilterExpressionParser) FilteredSignalIDs() []guid.Guid
- func (fep *FilterExpressionParser) SetParsingExceptionCallback(callback func(message string))
- func (fep *FilterExpressionParser) Table(tableName string) (*DataTable, error)
- type FunctionExpression
- type InListExpression
- type OperatorExpression
- type OrderByTerm
- type TableIDFields
- type TimeIntervalEnum
- type UnaryExpression
- type ValueExpression
- func EvaluateDataRowExpression(dataRow *DataRow, filterExpression string, suppressConsoleErrorOutput bool) (*ValueExpression, error)
- func EvaluateExpression(filterExpression string, suppressConsoleErrorOutput bool) (*ValueExpression, error)
- func GetValueExpression(expression Expression) (*ValueExpression, error)
- func NewValueExpression(valueType ExpressionValueTypeEnum, value interface{}) *ValueExpression
- func NullValue(targetValueType ExpressionValueTypeEnum) *ValueExpression
- func (ve *ValueExpression) BooleanValue() (bool, error)
- func (ve *ValueExpression) Convert(targetValueType ExpressionValueTypeEnum) (*ValueExpression, error)
- func (ve *ValueExpression) DateTimeValue() (time.Time, error)
- func (ve *ValueExpression) DecimalValue() (decimal.Decimal, error)
- func (ve *ValueExpression) DoubleValue() (float64, error)
- func (ve *ValueExpression) GuidValue() (guid.Guid, error)
- func (ve *ValueExpression) Int32Value() (int32, error)
- func (ve *ValueExpression) Int64Value() (int64, error)
- func (ve *ValueExpression) IsNull() bool
- func (ve *ValueExpression) String() string
- func (ve *ValueExpression) StringValue() (string, error)
- func (*ValueExpression) Type() ExpressionTypeEnum
- func (ve *ValueExpression) Value() interface{}
- func (ve *ValueExpression) ValueType() ExpressionValueTypeEnum
Constants ¶
const ( // XmlSchemaNamespace defines the schema namespace for the W3C XML Schema Definition Language (XSD) // used by STTP metadata tables. XmlSchemaNamespace = "http://www.w3.org/2001/XMLSchema" // ExtXmlSchemaDataNamespace is used to define extended types for XSD elements, e.g., Guid and expression data types. ExtXmlSchemaDataNamespace = "urn:schemas-microsoft-com:xml-msdata" // DateTimeFormat defines the format of date/time values in an XSD formatted XML schema. DateTimeFormat = "2006-01-02T15:04:05.99-07:00" )
Variables ¶
var DataType = struct { // String represents a Go string data type. String DataTypeEnum // Boolean represents a Go bool data type. Boolean DataTypeEnum // DateTime represents a Go time.Time data type. DateTime DataTypeEnum // Single represents a Go float32 data type. Single DataTypeEnum // Double represents a Go float64 data type. Double DataTypeEnum // Decimal represents a Go decimal.Decimal data type. // Type defined in github.com/shopspring/decimal. Decimal DataTypeEnum // Guid represents a Go guid.Guid data type. // Type defined in github.com/sttp/goapi/sttp/guid. Guid DataTypeEnum // Int8 represents a Go int8 data type. Int8 DataTypeEnum // Int16 represents a Go int16 data type. Int16 DataTypeEnum // Int32 represents a Go int32 data type. Int32 DataTypeEnum // Int64 represents a Go int64 data type. Int64 DataTypeEnum // UInt8 represents a Go uint8 data type. UInt8 DataTypeEnum // UInt16 represents a Go uint16 data type. UInt16 DataTypeEnum // UInt32 represents a Go uint32 data type. UInt32 DataTypeEnum // UInt64 represents a Go uint64 data type. UInt64 DataTypeEnum }{ String: 0, Boolean: 1, DateTime: 2, Single: 3, Double: 4, Decimal: 5, Guid: 6, Int8: 7, Int16: 8, Int32: 9, Int64: 10, UInt8: 11, UInt16: 12, UInt32: 13, UInt64: 14, }
DataType is an enumeration of the possible data types for a DataColumn.
var DefaultTableIDFields = &TableIDFields{
SignalIDFieldName: "SignalID",
MeasurementKeyFieldName: "ID",
PointTagFieldName: "PointTag",
}
DefaultTableIDFields defines the common default table ID field names.
var ExpressionFunctionType = struct { // Abs defines a function type that returns the absolute value of the specified numeric expression. Abs ExpressionFunctionTypeEnum // Ceiling defines a function type that returns the smallest integer that is greater than, or equal to, the specified numeric expression. Ceiling ExpressionFunctionTypeEnum // Coalesce defines a function type that returns the first non-null value in expression list. Coalesce ExpressionFunctionTypeEnum // Convert defines a function type that converts expression to the specified type. Convert ExpressionFunctionTypeEnum // Contains defines a function type that returns flag that determines if source string contains test string. Contains ExpressionFunctionTypeEnum // DateAdd defines a function type that adds value at specified interval to source date and then returns the date. DateAdd ExpressionFunctionTypeEnum // DateDiff defines a function type that returns the difference between left and right value at specified interval. DateDiff ExpressionFunctionTypeEnum // DatePart defines a function type that returns specified interval of source date. DatePart ExpressionFunctionTypeEnum // EndsWith defines a function type that returns flag that determines if source string ends with test string. EndsWith ExpressionFunctionTypeEnum // Floor defines a function type that returns the largest integer value that is smaller than, or equal to, the specified numeric expression. Floor ExpressionFunctionTypeEnum // IIf defines a function type that returns leftValue if result of expression is true, else returns rightValue. IIf ExpressionFunctionTypeEnum // IndexOf defines a function type that returns zero-based index of first occurrence of test in source, or -1 if not found. IndexOf ExpressionFunctionTypeEnum // IsDate defines a function type that returns flag that determines if expression is a DateTime value or can be parsed as one. IsDate ExpressionFunctionTypeEnum // IsInteger defines a function type that returns flag that determines if expression is an integer value or can be parsed as one. IsInteger ExpressionFunctionTypeEnum // IsGuid defines a function type that returns flag that determines if expression is a Guid value or can be parsed as one. IsGuid ExpressionFunctionTypeEnum // IsNull defines a function type that returns the specified defaultValue if expression is null, otherwise returns the expression. IsNull ExpressionFunctionTypeEnum // IsNumeric defines a function type that returns flag that determines if expression is a numeric value or can be parsed as one. IsNumeric ExpressionFunctionTypeEnum // LastIndexOf defines a function type that returns zero-based index of last occurrence of test in source, or -1 if not found. LastIndexOf ExpressionFunctionTypeEnum // Len defines a function type that returns length of expression interpreted as a string. Len ExpressionFunctionTypeEnum // Lower defines a function type that returns lower-case representation of expression interpreted as a string. Lower ExpressionFunctionTypeEnum // MaxOf defines a function type that returns value in expression list with maximum value. MaxOf ExpressionFunctionTypeEnum // MinOf defines a function type that returns value in expression list with minimum value. MinOf ExpressionFunctionTypeEnum // Now defines a function type that returns a DateTime value representing the current local system time. Now ExpressionFunctionTypeEnum // NthIndexOf defines a function type that returns zero-based index of the Nth, represented by index value, occurrence of test in source, or -1 if not found. NthIndexOf ExpressionFunctionTypeEnum // Power defines a function type that returns the value of specified numeric expression raised to the power of specified numeric exponent. Power ExpressionFunctionTypeEnum // RegExMatch defines a function type that returns flag that determines if test, interpreted as a string, is a match for specified regex string-based regular expression. RegExMatch ExpressionFunctionTypeEnum // RegExVal defines a function type that returns value from test, interpreted as a string, that is matched by specified regex string-based regular expression. RegExVal ExpressionFunctionTypeEnum // Replace defines a function type that returns a string where all instances of test found in source are replaced with replace value - all parameters interpreted as strings. Replace ExpressionFunctionTypeEnum // Reverse defines a function type that returns string where all characters in expression interpreted as a string are reversed. Reverse ExpressionFunctionTypeEnum // Round defines a function type that returns the nearest integer value to the specified numeric expression Round ExpressionFunctionTypeEnum // Split defines a function type that returns zero-based Nth, represented by index, value in source split by delimiter, or null if out of range. Split ExpressionFunctionTypeEnum // Sqrt defines a function type that returns the square root of the specified numeric expression Sqrt ExpressionFunctionTypeEnum // StartsWith defines a function type that returns flag that determines if source string starts with test string. StartsWith ExpressionFunctionTypeEnum // StrCount defines a function type that returns count of occurrences of test in source. StrCount ExpressionFunctionTypeEnum // StrCmp defines a function type that returns -1 if left is less-than right, 1 if left is greater-than right, or 0 if left equals right. StrCmp ExpressionFunctionTypeEnum // SubStr defines a function type that returns portion of source interpreted as a string starting at index. SubStr ExpressionFunctionTypeEnum // Trim defines a function type that removes white-space from the beginning and end of expression interpreted as a string. Trim ExpressionFunctionTypeEnum // TrimLeft defines a function type that removes white-space from the beginning of expression interpreted as a string. TrimLeft ExpressionFunctionTypeEnum // TrimRight defines a function type that removes white-space from the end of expression interpreted as a string. TrimRight ExpressionFunctionTypeEnum // Upper defines a function type that returns upper-case representation of expression interpreted as a string. Upper ExpressionFunctionTypeEnum // UtcNow defines a function type that returns a DateTime value representing the current UTC system time. UtcNow ExpressionFunctionTypeEnum }{ Abs: 0, Ceiling: 1, Coalesce: 2, Convert: 3, Contains: 4, DateAdd: 5, DateDiff: 6, DatePart: 7, EndsWith: 8, Floor: 9, IIf: 10, IndexOf: 11, IsDate: 12, IsInteger: 13, IsGuid: 14, IsNull: 15, IsNumeric: 16, LastIndexOf: 17, Len: 18, Lower: 19, MaxOf: 20, MinOf: 21, Now: 22, NthIndexOf: 23, Power: 24, RegExMatch: 25, RegExVal: 26, Replace: 27, Reverse: 28, Round: 29, Split: 30, Sqrt: 31, StartsWith: 32, StrCount: 33, StrCmp: 34, SubStr: 35, Trim: 36, TrimLeft: 37, TrimRight: 38, Upper: 39, UtcNow: 40, }
ExpressionFunctionType is an enumeration of possible expression function types.
var ExpressionOperatorType = struct { // Multiply defines a "*" operator type. Multiply ExpressionOperatorTypeEnum // Divide defines a "/" operator type. Divide ExpressionOperatorTypeEnum // Modulus defines a "%" operator type. Modulus ExpressionOperatorTypeEnum // Add defines an "+" operator type. Add ExpressionOperatorTypeEnum // Subtract defines a "-" operator type. Subtract ExpressionOperatorTypeEnum // BitShiftLeft defines a "<<" operator type. BitShiftLeft ExpressionOperatorTypeEnum // BitShiftRight defines a ">>" operator type. BitShiftRight ExpressionOperatorTypeEnum // BitwiseAnd defines a "&" operator type. BitwiseAnd ExpressionOperatorTypeEnum // BitwiseOr defines a "|" operator type. BitwiseOr ExpressionOperatorTypeEnum // BitwiseXor defines a "^" operator type. BitwiseXor ExpressionOperatorTypeEnum // LessThan defines a "<" operator type. LessThan ExpressionOperatorTypeEnum // LessThanOrEqual defines a "<=" operator type. LessThanOrEqual ExpressionOperatorTypeEnum // GreaterThan defines a ">" operator type. GreaterThan ExpressionOperatorTypeEnum // GreaterThanOrEqual defines a ">=" operator type. GreaterThanOrEqual ExpressionOperatorTypeEnum // Equal defines an "=" or "==" operator type. Equal ExpressionOperatorTypeEnum // EqualExactMatch defines an "===" operator type. EqualExactMatch ExpressionOperatorTypeEnum // NotEqual defines a "<>" or "!=" operator type. NotEqual ExpressionOperatorTypeEnum // NotEqualExactMatch defines a "!==" operator type. NotEqualExactMatch ExpressionOperatorTypeEnum // IsNull defines a "IS NULL" operator type. IsNull ExpressionOperatorTypeEnum // IsNotNull defines a "IS NOT NULL" operator type. IsNotNull ExpressionOperatorTypeEnum // Like defines a "LIKE" operator type. Like ExpressionOperatorTypeEnum // LikeExactMatch defines a "LIKE BINARY" or "LIKE ===" operator type. LikeExactMatch ExpressionOperatorTypeEnum // NotLike defines a "NOT LIKE" operator type. NotLike ExpressionOperatorTypeEnum // NotLikeExactMatch defines a "NOT LIKE BINARY" or "NOT LIKE ===" operator type. NotLikeExactMatch ExpressionOperatorTypeEnum // And defines an "AND" or "&&" operator type. And ExpressionOperatorTypeEnum // Or defines an "OR" or "||" operator type. Or ExpressionOperatorTypeEnum }{ Multiply: 0, Divide: 1, Modulus: 2, Add: 3, Subtract: 4, BitShiftLeft: 5, BitShiftRight: 6, BitwiseAnd: 7, BitwiseOr: 8, BitwiseXor: 9, LessThan: 10, LessThanOrEqual: 11, GreaterThan: 12, GreaterThanOrEqual: 13, Equal: 14, EqualExactMatch: 15, NotEqual: 16, NotEqualExactMatch: 17, IsNull: 18, IsNotNull: 19, Like: 20, LikeExactMatch: 21, NotLike: 22, NotLikeExactMatch: 23, And: 24, Or: 25, }
ExpressionOperatorType is an enumeration of possible expression operator types.
var ExpressionType = struct { // Value defines a value expression type. Value ExpressionTypeEnum // Unary defines an unary expression type. Unary ExpressionTypeEnum // Column defines a column expression type. Column ExpressionTypeEnum // InList defines an in-list expression type. InList ExpressionTypeEnum // Function defines a function expression type. Function ExpressionTypeEnum // Operator defines an operator expression type. Operator ExpressionTypeEnum }{ Value: 0, Unary: 1, Column: 2, InList: 3, Function: 4, Operator: 5, }
ExpressionType is an enumeration of possible expression types.
var ExpressionUnaryType = struct { // Plus defines the "+" unary operator. Plus ExpressionUnaryTypeEnum // Minus defines the "-" unary operator. Minus ExpressionUnaryTypeEnum // Not defines the "~" or "!" unary operator. Not ExpressionUnaryTypeEnum }{ Plus: 0, Minus: 1, Not: 2, }
ExpressionUnaryType is an enumeration of the possible expression unary types.
var ExpressionValueType = struct { // Boolean defines a bool value type for an expression. Boolean ExpressionValueTypeEnum // Int32 defines an int32 value type for an expression. Int32 ExpressionValueTypeEnum // Int64 defines an int64 value type for an expression. Int64 ExpressionValueTypeEnum // Decimal defines a decimal.Decimal value type for an expression. Decimal ExpressionValueTypeEnum // Double defines a float64 value type for an expression. Double ExpressionValueTypeEnum // String defines a string value type for an expression. String ExpressionValueTypeEnum // Guid defines a guid.Guid value type for an expression. Guid ExpressionValueTypeEnum // DateTime defines a time.Time value type for an expression. DateTime ExpressionValueTypeEnum // Undefined defines a nil value type for an expression. Undefined ExpressionValueTypeEnum // make sure value is always last in enum }{ Boolean: 0, Int32: 1, Int64: 2, Decimal: 3, Double: 4, String: 5, Guid: 6, DateTime: 7, Undefined: 8, }
ExpressionValueType is an enumeration of possible expression value data types. These expression value data types are reduced to a reasonable set of possible types that can be represented in a filter expression. All data table column values will be mapped to these types.
var TimeInterval = struct { // Year represents the year part of a DateTime. Year TimeIntervalEnum // Month represents the month part (1-12) of a DateTime. Month TimeIntervalEnum // DayOfYear represents the day of the year (1-366) of a DateTime. DayOfYear TimeIntervalEnum // Day represents the of of the month (1-31) of a DateTime. Day TimeIntervalEnum // Week represents the week of the year (1-53) of a DateTime. Week TimeIntervalEnum // WeekDay represents the day of the week (1-7) of a DateTime. WeekDay TimeIntervalEnum // Hour represents the hour of the day (0-23) of a DateTime. Hour TimeIntervalEnum // Minute represents the minute of the hour (0-59) of a DateTime. Minute TimeIntervalEnum // Second represents the second of the minute (0-59) of a DateTime. Second TimeIntervalEnum // Millisecond represents the millisecond of the second (0-999) of a DateTime. Millisecond TimeIntervalEnum }{ Year: 0, Month: 1, DayOfYear: 2, Day: 3, Week: 4, WeekDay: 5, Hour: 6, Minute: 7, Second: 8, Millisecond: 9, }
TimeInterval is an enumeration of possible DateTime intervals.
Functions ¶
func CompareDataRowColumns ¶
func CompareDataRowColumns(leftRow, rightRow *DataRow, columnIndex int, exactMatch bool) (int, error)
CompareDataRowColumns returns an integer comparing two DataRow column values for the specified column index. The result will be 0 if leftRow==rightRow, -1 if leftRow < rightRow, and +1 if leftRow > rightRow. An error will br returned if column index is out of range of either row, or row types do not match.
func ExpressionValueTypeLen ¶
func ExpressionValueTypeLen() int
ExpressionValueTypeLen gets the number of elements in the ExpressionValueType enumeration.
func SelectSignalIDSet ¶
func SelectSignalIDSet(dataSet *DataSet, filterExpression string, primaryTable string, tableIDFields *TableIDFields, suppressConsoleErrorOutput bool) (guid.HashSet, error)
SelectSignalIDSet returns all unique Guid signal IDs matching the provided filterExpression and dataSet. Filter expressions can contain multiple statements, separated by semi-colons, where each statement results in a unique expression tree; this function returns the combined results of each encountered filter expression statement. Returned guid.HashSet will contain only unique signal IDs, in arbitrary order. Any encountered "TOP" limit clauses for individual filter expression statements will be respected, but "ORDER BY" clauses will be ignored. An error will be returned if dataSet parameter is nil, the filterExpression is empty, expression fails to parse or any row expresssion evaluation fails.
func SelectSignalIDSetFromTable ¶
func SelectSignalIDSetFromTable(dataTable *DataTable, filterExpression string, primaryTable string, tableIDFields *TableIDFields, suppressConsoleErrorOutput bool) (guid.HashSet, error)
SelectSignalIDSetFromTable returns all unique Guid signal IDs matching the provided filterExpression and dataTable. Filter expressions can contain multiple statements, separated by semi-colons, where each statement results in a unique expression tree; this function returns the combined results of each encountered filter expression statement. Returned guid.HashSet will contain only unique signal IDs, in arbitrary order. Any encountered "TOP" limit clauses for individual filter expression statements will be respected, but "ORDER BY" clauses will be ignored. An error will be returned if dataTable parameter (or its parent DataSet) is nil, the filterExpression is empty, expression fails to parse or any row expresssion evaluation fails.
Types ¶
type CallbackErrorListener ¶
type CallbackErrorListener struct { *antlr.DefaultErrorListener // ParsingExceptionCallback defines a callback for reporting ANTLR parsing exceptions. ParsingExceptionCallback func(message string) }
CallbackErrorListener defines a implementation of an ANTLR error listener that reports any parsing exceptions to a user defined callback.
func NewCallbackErrorListener ¶
func NewCallbackErrorListener() *CallbackErrorListener
NewCallbackErrorListener creates a new NewCallbackErrorListener.
func (*CallbackErrorListener) SyntaxError ¶
func (cel *CallbackErrorListener) SyntaxError(recognizer antlr.Recognizer, offendingSymbol interface{}, line, column int, msg string, e antlr.RecognitionException)
SyntaxError is called when ANTLR parser encounters a syntax error.
type ColumnExpression ¶
type ColumnExpression struct {
// contains filtered or unexported fields
}
ColumnExpression represents a column expression.
func GetColumnExpression ¶
func GetColumnExpression(expression Expression) (*ColumnExpression, error)
GetColumnExpression gets the expression cast to a ColumnExpression. An error will be returned if expression is nil or not ExpressionType.Column.
func NewColumnExpression ¶
func NewColumnExpression(dataColumn *DataColumn) *ColumnExpression
NewColumnExpression creates a new column expression.
func (*ColumnExpression) DataColumn ¶
func (ce *ColumnExpression) DataColumn() *DataColumn
DataColumn gets the data column of the ColumnExpression.
func (*ColumnExpression) Type ¶
func (*ColumnExpression) Type() ExpressionTypeEnum
Type gets expression type of the ColumnExpression.
type DataColumn ¶
type DataColumn struct {
// contains filtered or unexported fields
}
DataColumn represents a column, i.e., a field, in a DataTable defining a name and a data type. Data columns can also be computed where its value would be derived from other columns and functions (https://sttp.github.io/documentation/filter-expressions/) defined in an expression.
func (*DataColumn) Computed ¶
func (dc *DataColumn) Computed() bool
Computed gets a flag that determines if the DataColumn is a computed value, i.e., has a defined expression.
func (*DataColumn) Expression ¶
func (dc *DataColumn) Expression() string
Expression gets the column expression value of the DataColumn, if any.
func (*DataColumn) Index ¶
func (dc *DataColumn) Index() int
Index gets the index of the DataColumn within its parent DataTable columns collection.
func (*DataColumn) Name ¶
func (dc *DataColumn) Name() string
Name gets the column name of the DataColumn.
func (*DataColumn) Parent ¶
func (dc *DataColumn) Parent() *DataTable
Parent gets the parent DataTable of the DataColumn.
func (*DataColumn) String ¶
func (dc *DataColumn) String() string
String gets a representation of the DataColumn as a string.
func (*DataColumn) Type ¶
func (dc *DataColumn) Type() DataTypeEnum
Type gets the column DataType enumeration value of the DataColumn.
type DataRow ¶
type DataRow struct {
// contains filtered or unexported fields
}
DataRow represents a row, i.e., a record, in a DataTable defining a set of values for each defined DataColumn field in the DataTable columns collection.
func SelectDataRows ¶
func SelectDataRows(dataSet *DataSet, filterExpression string, primaryTable string, tableIDFields *TableIDFields, suppressConsoleErrorOutput bool) ([]*DataRow, error)
SelectDataRows returns all rows matching the provided filterExpression and dataSet. Filter expressions can contain multiple statements, separated by semi-colons, where each statement results in a unique expression tree; this function returns the combined results of each encountered filter expression statement. Returned DataRow slice will contain all matching rows, order preserved. If dataSet includes duplicated rows, it will be possible for the result set to contain duplicates. Any encountered "TOP" limit or "ORDER BY" clauses will be respected. An error will be returned if dataSet parameter is nil, the filterExpression is empty, expression fails to parse or any row expresssion evaluation fails.
func SelectDataRowsFromTable ¶
func SelectDataRowsFromTable(dataTable *DataTable, filterExpression string, primaryTable string, tableIDFields *TableIDFields, suppressConsoleErrorOutput bool) ([]*DataRow, error)
SelectDataRowsFromTable returns all rows matching the provided filterExpression and dataTable. Filter expressions can contain multiple statements, separated by semi-colons, where each statement results in a unique expression tree; this function returns the combined results of each encountered filter expression statement. Returned DataRow slice will contain all matching rows, order preserved. If dataSet includes duplicated rows, it will be possible for the result set to contain duplicates. Any encountered "TOP" limit or "ORDER BY" clauses will be respected. An error will be returned if dataTable parameter (or its parent DataSet) is nil, the filterExpression is empty, expression fails to parse or any row expresssion evaluation fails.
func (*DataRow) BooleanValue ¶
BooleanValue gets the record value at the specified columnIndex cast as a bool. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.Boolean.
func (*DataRow) BooleanValueByName ¶
BooleanValueByName gets the record value for the specified columnName cast as a bool. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.Boolean.
func (*DataRow) ColumnValueAsString ¶
func (dr *DataRow) ColumnValueAsString(column *DataColumn) string
ColumnValueAsString reads the record value for the specified data column converted to a string. For any errors, an empty string will be returned.
func (*DataRow) DateTimeValue ¶
DateTimeValue gets the record value at the specified columnIndex cast as a time.Time. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.DateTime.
func (*DataRow) DateTimeValueByName ¶
DateTimeValueByName gets the record value for the specified columnName cast as a time.Time. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.DateTime.
func (*DataRow) DecimalValue ¶
DecimalValue gets the record value at the specified columnIndex cast as a decimal.Decimal. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.Decimal.
func (*DataRow) DecimalValueByName ¶
DecimalValueByName gets the record value for the specified columnName cast as a decimal.Decimal. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.Decimal.
func (*DataRow) DoubleValue ¶
DoubleValue gets the record value at the specified columnIndex cast as a float64. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.Double.
func (*DataRow) DoubleValueByName ¶
DoubleValueByName gets the record value for the specified columnName cast as a float64. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.Double.
func (*DataRow) GuidValue ¶
GuidValue gets the record value at the specified columnIndex cast as a guid.Guid. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.Guid.
func (*DataRow) GuidValueByName ¶
GuidValueByName gets the record value for the specified columnName cast as a guid.Guid. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.Guid.
func (*DataRow) Int16Value ¶
Int16Value gets the record value at the specified columnIndex cast as an int16. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.Int16.
func (*DataRow) Int16ValueByName ¶
Int16ValueByName gets the record value for the specified columnName cast as an int16. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.Int16.
func (*DataRow) Int32Value ¶
Int32Value gets the record value at the specified columnIndex cast as an int32. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.Int32.
func (*DataRow) Int32ValueByName ¶
Int32ValueByName gets the record value for the specified columnName cast as an int32. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.Int32.
func (*DataRow) Int64Value ¶
Int64Value gets the record value at the specified columnIndex cast as an int64. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.Int64.
func (*DataRow) Int64ValueByName ¶
Int64ValueByName gets the record value for the specified columnName cast as an int64. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.Int64.
func (*DataRow) Int8Value ¶
Int8Value gets the record value at the specified columnIndex cast as an int8. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.Int8.
func (*DataRow) Int8ValueByName ¶
Int8ValueByName gets the record value for the specified columnName cast as an int8. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.Int8.
func (*DataRow) SetValueByName ¶
SetValueByName assigns the record value for the specified columnName.
func (*DataRow) SingleValue ¶
SingleValue gets the record value at the specified columnIndex cast as a float32. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.Single.
func (*DataRow) SingleValueByName ¶
SingleValueByName gets the record value for the specified columnName cast as a float32. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.Single.
func (*DataRow) StringValue ¶
StringValue gets the record value at the specified columnIndex cast as a string. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.String.
func (*DataRow) StringValueByName ¶
StringValueByName gets the record value for the specified columnName cast as a string. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.String.
func (*DataRow) UInt16Value ¶
UInt16Value gets the record value at the specified columnIndex cast as an uint16. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.UInt16.
func (*DataRow) UInt16ValueByName ¶
UInt16ValueByName gets the record value for the specified columnName cast as an uint16. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.UInt16.
func (*DataRow) UInt32Value ¶
UInt32Value gets the record value at the specified columnIndex cast as an uint32. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.UInt32.
func (*DataRow) UInt32ValueByName ¶
UInt32ValueByName gets the record value for the specified columnName cast as an uint32. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.UInt32.
func (*DataRow) UInt64Value ¶
UInt64Value gets the record value at the specified columnIndex cast as an uint64. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.UInt64.
func (*DataRow) UInt64ValueByName ¶
UInt64ValueByName gets the record value for the specified columnName cast as an uint64. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.UInt64.
func (*DataRow) UInt8Value ¶
UInt8Value gets the record value at the specified columnIndex cast as an uint8. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.UInt8.
func (*DataRow) UInt8ValueByName ¶
UInt8ValueByName gets the record value for the specified columnName cast as an uint8. Second parameter in tuple return value indicates if original value was nil. An error will be returned if column type is not DataType.UInt8.
func (*DataRow) ValueAsString ¶
ValueAsString reads the record value at the specified columnIndex converted to a string. For columnIndex out of range or any other errors, an empty string will be returned.
func (*DataRow) ValueAsStringByName ¶
ValueAsStringByName reads the record value for the specified columnName converted to a string. For columnName not found or any other errors, an empty string will be returned.
func (*DataRow) ValueByName ¶
ValueByName reads the record value for the specified columnName.
type DataRowHashSet ¶
type DataRowHashSet map[*DataRow]void
DataRowHashSet represents a distinct collection of *DataRow values, i.e., a set. A DataRowHashSet is not sorted and will not contain duplicate elements. The methods of the DataRowHashSet are not intrinsically thread-safe procedures, to guarantee thread safety, you should initiate a lock before calling a method.
func NewDataRowHashSet ¶
func NewDataRowHashSet(items []*DataRow) DataRowHashSet
NewDataRowHashSet creates a new set containing all elements in the specified slice. Returns a new DataRowHashSet that contain the specified slice items.
func SelectDataRowSet ¶
func SelectDataRowSet(dataSet *DataSet, filterExpression string, primaryTable string, tableIDFields *TableIDFields, suppressConsoleErrorOutput bool) (DataRowHashSet, error)
SelectDataRowSet returns all unique rows matching the provided filterExpression and dataSet. Filter expressions can contain multiple statements, separated by semi-colons, where each statement results in a unique expression tree; this function returns the combined results of each encountered filter expression statement. Returned DataRowHashSet will contain only unique rows, in arbitrary order. Any encountered "TOP" limit clauses for individual filter expression statements will be respected, but "ORDER BY" clauses will be ignored. An error will be returned if dataSet parameter is nil, the filterExpression is empty, expression fails to parse or any row expresssion evaluation fails.
func SelectDataRowSetFromTable ¶
func SelectDataRowSetFromTable(dataTable *DataTable, filterExpression string, tableIDFields *TableIDFields, suppressConsoleErrorOutput bool) (DataRowHashSet, error)
SelectDataRowSetFromTable returns all unique rows matching the provided filterExpression and dataTable. Filter expressions can contain multiple statements, separated by semi-colons, where each statement results in a unique expression tree; this function returns the combined results of each encountered filter expression statement. Returned DataRowHashSet will contain only unique rows, in arbitrary order. Any encountered "TOP" limit clauses for individual filter expression statements will be respected, but "ORDER BY" clauses will be ignored. An error will be returned if dataTable parameter (or its parent DataSet) is nil, the filterExpression is empty, expression fails to parse or any row expresssion evaluation fails.
func (DataRowHashSet) Add ¶
func (hs DataRowHashSet) Add(item *DataRow) bool
Add adds the specified element to a set. Returns true if item was added to the set; otherwise, false.
func (DataRowHashSet) Clear ¶
func (hs DataRowHashSet) Clear()
Clear removes all elements from a set.
func (DataRowHashSet) Contains ¶
func (hs DataRowHashSet) Contains(item *DataRow) bool
Contains determines whether a set contains the specified element. Returns true if the set contains the specified element; otherwise, false.
func (DataRowHashSet) ExceptWith ¶
func (hs DataRowHashSet) ExceptWith(other []*DataRow)
ExceptWith removes all elements in the specified slice from the current set.
func (DataRowHashSet) ExceptWithSet ¶
func (hs DataRowHashSet) ExceptWithSet(other DataRowHashSet)
ExceptWithSet removes all elements in the specified set from the current set.
func (DataRowHashSet) IntersectWith ¶
func (hs DataRowHashSet) IntersectWith(other []*DataRow)
IntersectWith modifies the current set to contain only elements that are present in the set and in the specified slice.
func (DataRowHashSet) IntersectWithSet ¶
func (hs DataRowHashSet) IntersectWithSet(other DataRowHashSet)
IntersectWithSet modifies the current set to contain only elements that are present in the set and in the specified set.
func (DataRowHashSet) IsEmpty ¶
func (hs DataRowHashSet) IsEmpty() bool
IsEmpty determines if set contains no elements. Returns true if the set is empty, i.e., has a length of zero; otherwise, false.
func (DataRowHashSet) IsProperSubsetOf ¶
func (hs DataRowHashSet) IsProperSubsetOf(other []*DataRow) bool
IsProperSubsetOf determines whether a set is a proper subset of the specified slice. Returns true if the set is a proper subset of other slice items; otherwise, false.
func (DataRowHashSet) IsProperSubsetOfSet ¶
func (hs DataRowHashSet) IsProperSubsetOfSet(other DataRowHashSet) bool
IsProperSubsetOfSet determines whether a set is a proper subset of the specified set. Returns true if the set is a proper subset of other set; otherwise, false.
func (DataRowHashSet) IsProperSupersetOf ¶
func (hs DataRowHashSet) IsProperSupersetOf(other []*DataRow) bool
IsProperSupersetOf determines whether a set is a proper superset of the specified slice. Returns true if the set is a proper superset of other slice items; otherwise, false.
func (DataRowHashSet) IsProperSupersetOfSet ¶
func (hs DataRowHashSet) IsProperSupersetOfSet(other DataRowHashSet) bool
IsProperSupersetOfSet determines whether a set is a proper superset of the specified set. Returns true if the set is a proper superset of other set; otherwise, false.
func (DataRowHashSet) IsSubsetOf ¶
func (hs DataRowHashSet) IsSubsetOf(other []*DataRow) bool
IsSubsetOf determines whether a set is a subset of the specified slice. Returns true if the set is a subset of other slice items; otherwise, false.
func (DataRowHashSet) IsSubsetOfSet ¶
func (hs DataRowHashSet) IsSubsetOfSet(other DataRowHashSet) bool
IsSubsetOfSet determines whether a set is a subset of the specified set. Returns true if the set is a subset of other set; otherwise, false.
func (DataRowHashSet) IsSupersetOf ¶
func (hs DataRowHashSet) IsSupersetOf(other []*DataRow) bool
IsSupersetOf determines whether a set is a superset of the specified slice. Returns true if the set is a superset of other slice items; otherwise, false.
func (DataRowHashSet) IsSupersetOfSet ¶
func (hs DataRowHashSet) IsSupersetOfSet(other DataRowHashSet) bool
IsSupersetOfSet determines whether a set is a superset of the specified set. Returns true if the set is a superset of other set; otherwise, false.
func (DataRowHashSet) Keys ¶
func (hs DataRowHashSet) Keys() []*DataRow
Keys copies the elements of a set to a slice. Returns a slice containing the elements of the set.
func (DataRowHashSet) Overlaps ¶
func (hs DataRowHashSet) Overlaps(other []*DataRow) bool
Overlaps determines whether the current set and a specified slice share common elements. Returns true if the current set and other slice items share at least one common element; otherwise, false.
func (DataRowHashSet) OverlapsSet ¶
func (hs DataRowHashSet) OverlapsSet(other DataRowHashSet) bool
OverlapsSet determines whether the current set and a specified set share common elements. Returns true if the current set and other set share at least one common element; otherwise, false.
func (DataRowHashSet) Remove ¶
func (hs DataRowHashSet) Remove(item *DataRow) bool
Remove removes the specified element from a set. Returns true if item was removed from the set; otherwise, false.
func (DataRowHashSet) RemoveWhere ¶
func (hs DataRowHashSet) RemoveWhere(predicate func(*DataRow) bool) int
RemoveWhere removes all elements that match the conditions defined by the specified predicate from a set. Returns number of elements that were removed from the set.
func (DataRowHashSet) SetEquals ¶
func (hs DataRowHashSet) SetEquals(other []*DataRow) bool
SetEquals determines whether a set and the specified slice contain the same elements. Returns true if the set is equal to other slice items; otherwise, false.
func (DataRowHashSet) SetEqualsSet ¶
func (hs DataRowHashSet) SetEqualsSet(other DataRowHashSet) bool
SetEqualsSet determines whether a set and the specified set contain the same elements. Returns true if the set is equal to other set; otherwise, false.
func (DataRowHashSet) SymmetricExceptWith ¶
func (hs DataRowHashSet) SymmetricExceptWith(other []*DataRow)
SymmetricExceptWith modifies the current set to contain only elements that are present either in the set or in the specified slice, but not both.
func (DataRowHashSet) SymmetricExceptWithSet ¶
func (hs DataRowHashSet) SymmetricExceptWithSet(other DataRowHashSet)
SymmetricExceptWithSet modifies the current set to contain only elements that are present either in the set or in the specified set, but not both.
func (DataRowHashSet) UnionWith ¶
func (hs DataRowHashSet) UnionWith(other []*DataRow)
UnionWith modifies the current set to contain all elements that are present in the set, the specified slice, or both.
func (DataRowHashSet) UnionWithSet ¶
func (hs DataRowHashSet) UnionWithSet(other DataRowHashSet)
UnionWithSet modifies the current set to contain all elements that are present in the set, the specified set, or both.
type DataSet ¶
type DataSet struct { // Name defines the name of the DataSet. Name string // contains filtered or unexported fields }
DataSet represents an in-memory cache of records that is structured similarly to information defined in a database. The data set object consists of a collection of data table objects. See https://sttp.github.io/documentation/data-sets/ for more information. Note that this implementation uses a case-insensitive map for DataTable name lookups. Internally, case-insensitive lookups are accomplished using `strings.ToUpper`.
func (*DataSet) CreateTable ¶
CreateTable creates a new DataTable associated with the DataSet. Use AddTable to add the new table to the DataSet.
func (*DataSet) ParseXmlDocument ¶
func (ds *DataSet) ParseXmlDocument(doc *xml.XmlDocument) error
ParseXmlDocument loads the DataSet from an existing XmlDocument.
func (*DataSet) RemoveTable ¶
RemoveTable removes the specified tableName from the DataSet. Returns true if table was removed; otherwise, false if it did not exist. Lookup is case-insensitive.
func (*DataSet) Table ¶
Table gets the DataTable for the specified tableName if the name exists; otherwise, nil is returned. Lookup is case-insensitive.
func (*DataSet) TableCount ¶
TableCount gets the total number of tables defined in the DataSet.
func (*DataSet) TableNames ¶
TableNames gets the table names defined in the DataSet.
type DataTable ¶
type DataTable struct {
// contains filtered or unexported fields
}
DataTable represents a collection of DataColumn objects where each data column defines a name and a data type. Data columns can also be computed where its value would be derived from other columns and functions (https://sttp.github.io/documentation/filter-expressions/) defined in an expression. Note that this implementation uses a case-insensitive map for DataColumn name lookups. Internally, case-insensitive lookups are accomplished using `strings.ToUpper`.
func (*DataTable) AddColumn ¶
func (dt *DataTable) AddColumn(column *DataColumn)
AddColumn adds the specified column to the DataTable.
func (*DataTable) CloneColumn ¶
func (dt *DataTable) CloneColumn(source *DataColumn) *DataColumn
CloneColumn creates a copy of the specified source DataColumn associated with the DataTable.
func (*DataTable) CloneRow ¶
CloneRow creates a copy of the specified source DataRow associated with the DataTable.
func (*DataTable) Column ¶
func (dt *DataTable) Column(columnIndex int) *DataColumn
Column gets the DataColumn at the specified columnIndex if the index is in range; otherwise, nil is returned.
func (*DataTable) ColumnByName ¶
func (dt *DataTable) ColumnByName(columnName string) *DataColumn
ColumnByName gets the DataColumn for the specified columnName if the name exists; otherwise, nil is returned. Lookup is case-insensitive.
func (*DataTable) ColumnCount ¶
ColumnCount gets the total number columns defined in the DataTable.
func (*DataTable) ColumnIndex ¶
ColumnIndex gets the index for the specified columnName if the name exists; otherwise, -1 is returned. Lookup is case-insensitive.
func (*DataTable) CreateColumn ¶
func (dt *DataTable) CreateColumn(name string, dataType DataTypeEnum, expression string) *DataColumn
CreateColumn creates a new DataColumn associated with the DataTable. Use AddColumn to add the new column to the DataTable.
func (*DataTable) CreateRow ¶
CreateRow creates a new DataRow associated with the DataTable. Use AddRow to add the new row to the DataTable.
func (*DataTable) InitColumns ¶
InitColumns initializes the internal column collection to the specified length. Any existing columns will be deleted.
func (*DataTable) InitRows ¶
InitRows initializes the internal row collection to the specified length. Any existing rows will be deleted.
func (*DataTable) Row ¶
Row gets the DataRow at the specified rowIndex if the index is in range; otherwise, nil is returned.
func (*DataTable) RowValueAsString ¶
RowValueAsString reads the row record value at the specified columnIndex converted to a string. For columnIndex out of range or any other errors, an empty string will be returned.
func (*DataTable) RowValueAsStringByName ¶
RowValueAsStringByName reads the row record value for the specified columnName converted to a string. For columnName not found or any other errors, an empty string will be returned.
func (*DataTable) RowsWhere ¶
RowsWhere returns the rows matching the predicate expression. Set limit parameter to -1 for all matching rows.
func (*DataTable) Select ¶
func (dt *DataTable) Select(filterExpression string, sortOrder string, limit int) ([]*DataRow, error)
Select returns the rows matching the filterExpression criteria in the specified sort order. The filterExpression parameter should be in the syntax of a SQL WHERE expression but should not include the WHERE keyword. The sortOrder parameter defines field names, separated by commas, that exist in the DataTable used to order the results. Each field specified in the sortOrder can have an ASC or DESC suffix; defaults to ASC when no suffix is provided. When sortOrder is an empty string, records will be returned in natural order. Set limit parameter to -1 for all matching rows. When filterExpression is an empty string, all records will be returned; any specified sortOrder and limit will still be respected.
type DataTypeEnum ¶
type DataTypeEnum int
DataTypeEnum defines the type of the DataType enumeration.
func ParseXsdDataType ¶
func ParseXsdDataType(xsdTypeName, extDataType string) (DataTypeEnum, bool)
ParseXsdDataType gets the DataType from the provided XSD data type. Return tuple includes boolean value that determines if parse was successful. See XML Schema Language Datatypes for possible xsdTypeName values: https://www.w3.org/TR/xmlschema-2/
func (DataTypeEnum) String ¶
func (dte DataTypeEnum) String() string
String gets the DataType enumeration name as a string.
type Expression ¶
type Expression interface { // Type gets the type of the expression. Type() ExpressionTypeEnum }
Expression is the interface that can represent all expression types
type ExpressionFunctionTypeEnum ¶
type ExpressionFunctionTypeEnum int
ExpressionFunctionTypeEnum defines the type of the ExpressionFunctionType enumeration.
func (ExpressionFunctionTypeEnum) String ¶
func (efte ExpressionFunctionTypeEnum) String() string
String gets the ExpressionFunctionType enumeration value as a string.
type ExpressionOperatorTypeEnum ¶
type ExpressionOperatorTypeEnum int
ExpressionOperatorTypeEnum defines the type of the ExpressionOperatorType enumeration.
func (ExpressionOperatorTypeEnum) String ¶
func (eote ExpressionOperatorTypeEnum) String() string
String gets the ExpressionOperatorType enumeration value as a string.
type ExpressionTree ¶
type ExpressionTree struct { // TableName represents the associated table name parsed from "FILTER" statement, if any. TableName string // TopLimit represents the parsed value associated with the "TOP" keyword, if any. TopLimit int // OrderByTerms represents the order by elements parsed from the "ORDER BY" keyword, if any. OrderByTerms []*OrderByTerm // Root is the starting Expression for evaluation of the expression tree, or nil if there // is not one. This is the root expression of the ExpressionTree. Value is automatically // managed by FilterExpressionParser. Root Expression // contains filtered or unexported fields }
ExpressionTree represents a tree of expressions for evaluation.
func GenerateExpressionTree ¶
func GenerateExpressionTree(dataTable *DataTable, filterExpression string, suppressConsoleErrorOutput bool) (*ExpressionTree, error)
GenerateExpressionTree gets the first produced expression tree for the provided filterExpression and dataTable. If filterExpression contains multiple semi-colon separated statements, only the first expression is returned. An error will be returned if dataTable parameter is nil, the filterExpression is empty or expression fails to parse.
func GenerateExpressionTrees ¶
func GenerateExpressionTrees(dataSet *DataSet, primaryTable string, filterExpression string, suppressConsoleErrorOutput bool) ([]*ExpressionTree, error)
GenerateExpressionTrees produces a set of expression trees for the provided filterExpression and dataSet. One expression tree will be produced per filter expression statement encountered in the specified filterExpression. If primaryTable parameter is not defined, then filter expression should not contain directly defined signal IDs. An error will be returned if dataSet parameter is nil, the filterExpression is empty or expression fails to parse.
func GenerateExpressionTreesFromTable ¶
func GenerateExpressionTreesFromTable(dataTable *DataTable, filterExpression string, suppressConsoleErrorOutput bool) ([]*ExpressionTree, error)
GenerateExpressionTreesFromTable produces a set of expression trees for the provided filterExpression and dataTable. One expression tree will be produced per filter expression statement encountered in the specified filterExpression. An error will be returned if dataTable parameter is nil, the filterExpression is empty or expression fails to parse.
func NewExpressionTree ¶
func NewExpressionTree() *ExpressionTree
NewExpressionTree creates a new expression tree.
func (*ExpressionTree) Evaluate ¶
func (et *ExpressionTree) Evaluate(dataRow *DataRow) (*ValueExpression, error)
Evaluate traverses the the ExpressionTree for the provided dataRow to produce a ValueExpression. Root expression should be assigned before calling Evaluate. The dataRow parameter can be nil if there are no columns references in expression tree. An error will be returned if the expresssion evaluation fails.
func (*ExpressionTree) Select ¶
func (et *ExpressionTree) Select(table *DataTable) ([]*DataRow, error)
Select returns the rows matching the the ExpressionTree. The expression tree result type is expected to be a Boolean for this filtering operation. This works like the "WHERE" clause of a SQL expression. Any "TOP" limit and "ORDER BY" sorting clauses found in filter expressions will be respected. An error will be returned if the table parameter is nil, the expression tree does not yield a boolean value or any row expresssion evaluation fails.
func (*ExpressionTree) SelectWhere ¶
func (et *ExpressionTree) SelectWhere(table *DataTable, predicate func(*ValueExpression) (bool, error), applyLimit bool, applySort bool) ([]*DataRow, error)
SelectWhere returns each table row evaluated from the ExpressionTree that matches the specified predicate expression. The applyLimit and applySort flags determine if any encountered "TOP" limit and "ORDER BY" sorting clauses will be respected. An error will be returned if the table parameter is nil or any row expresssion evaluation fails. gocyclo: ignore
type ExpressionTypeEnum ¶
type ExpressionTypeEnum int
ExpressionTypeEnum defines the type of the ExpressionType enumeration.
func (ExpressionTypeEnum) String ¶
func (ete ExpressionTypeEnum) String() string
String gets the ExpressionType enumeration value as a string.
type ExpressionUnaryTypeEnum ¶
type ExpressionUnaryTypeEnum int
ExpressionUnaryTypeEnum defines the type of the ExpressionUnaryType enumeration.
func (ExpressionUnaryTypeEnum) String ¶
func (eute ExpressionUnaryTypeEnum) String() string
String gets the ExpressionUnaryType enumeration value as a string.
type ExpressionValueTypeEnum ¶
type ExpressionValueTypeEnum int
ExpressionValueTypeEnum defines the type of the ExpressionValueType enumeration.
var ZeroExpressionValueType ExpressionValueTypeEnum = 0
ZeroExpressionValueType defines the zero value for the ExpressionValueType enumeration
func (ExpressionValueTypeEnum) IsIntegerType ¶
func (evte ExpressionValueTypeEnum) IsIntegerType() bool
IsIntegerType gets a flag that determines if the ExpressionValueType enumeration value represents an integer type.
func (ExpressionValueTypeEnum) IsNumericType ¶
func (evte ExpressionValueTypeEnum) IsNumericType() bool
IsNumericType gets a flag that determines if the ExpressionValueType enumeration value represents a numeric type.
func (ExpressionValueTypeEnum) String ¶
func (evte ExpressionValueTypeEnum) String() string
String gets the ExpressionValueType enumeration value as a string.
type FilterExpressionParser ¶
type FilterExpressionParser struct { *parser.BaseFilterExpressionSyntaxListener // DataSet defines the source metadata used for parsing the filter expression. DataSet *DataSet // PrimaryTableName defines the name of the table to use in the DataSet when filter // expressions do not specify a table name, e.g., direct signal identification. See: // https://sttp.github.io/documentation/filter-expressions/#direct-signal-identification PrimaryTableName string // TableIDFields defines a map of table ID fields associated with table names. TableIDFields map[string]*TableIDFields // TrackFilteredRows enables tracking of matching rows during filter expression evaluation. // Value defaults to true. Set value to false and set TrackFilteredSignalIDs to true if // only signal IDs are needed post filter expression evaluation. TrackFilteredRows bool // TrackFilteredSignalIDs enables tracking of matching signal IDs during filter expression // evaluation. Value defaults to false. TrackFilteredSignalIDs bool // contains filtered or unexported fields }
FilterExpressionParser represents a parser for STTP filter expressions.
func NewFilterExpressionParser ¶
func NewFilterExpressionParser(filterExpression string, suppressConsoleErrorOutput bool) *FilterExpressionParser
NewFilterExpressionParser creates a new FilterExpressionParser.
func NewFilterExpressionParserForDataSet ¶
func NewFilterExpressionParserForDataSet(dataSet *DataSet, filterExpression string, primaryTable string, tableIDFields *TableIDFields, suppressConsoleErrorOutput bool) (*FilterExpressionParser, error)
NewFilterExpressionParserForDataSet creates a new filter expression parser associated with the provided dataSet and provided table details. Error will be returned if dataSet parameter is nil or the filterExpression is empty.
func (*FilterExpressionParser) EnterExpression ¶
func (fep *FilterExpressionParser) EnterExpression(*parser.ExpressionContext)
EnterExpression is called when production expression is entered.
func (*FilterExpressionParser) EnterFilterExpressionStatement ¶
func (fep *FilterExpressionParser) EnterFilterExpressionStatement(context *parser.FilterExpressionStatementContext)
EnterFilterExpressionStatement is called when production filterExpressionStatement is entered.
func (*FilterExpressionParser) EnterFilterStatement ¶
func (fep *FilterExpressionParser) EnterFilterStatement(context *parser.FilterStatementContext)
EnterFilterStatement is called when production filterStatement is entered.
func (*FilterExpressionParser) Evaluate ¶
func (fep *FilterExpressionParser) Evaluate(applyLimit bool, applySort bool) error
Evaluate parses each statement in the filter expression and tracks the results. Filter expressions can contain multiple statements, separated by semi-colons, where each statement results in a unique expression tree; this function returns the combined results of each encountered filter expression statement, yielding all filtered rows and/or signal IDs that match the target filter expression. The applyLimit and applySort flags determine if any encountered "TOP" limit and "ORDER BY" sorting clauses will be respected. Access matching results via FilteredRows and/or FilteredSignalIDs, or related set functions. An error will be returned if expression fails to parse or any row expresssion evaluation fails. gocyclo: ignore
func (*FilterExpressionParser) ExitColumnName ¶
func (fep *FilterExpressionParser) ExitColumnName(context *parser.ColumnNameContext)
ExitColumnName is called when production columnName is exited.
func (*FilterExpressionParser) ExitExpression ¶
func (fep *FilterExpressionParser) ExitExpression(context *parser.ExpressionContext)
ExitExpression is called when production expression is exited.
func (*FilterExpressionParser) ExitFunctionExpression ¶
func (fep *FilterExpressionParser) ExitFunctionExpression(context *parser.FunctionExpressionContext)
ExitFunctionExpression is called when production functionExpression is exited. gocyclo: ignore
func (*FilterExpressionParser) ExitIdentifierStatement ¶
func (fep *FilterExpressionParser) ExitIdentifierStatement(context *parser.IdentifierStatementContext)
ExitIdentifierStatement is called when production identifierStatement is exited. gocyclo: ignore
func (*FilterExpressionParser) ExitLiteralValue ¶
func (fep *FilterExpressionParser) ExitLiteralValue(context *parser.LiteralValueContext)
ExitLiteralValue is called when production literalValue is exited. gocyclo: ignore
func (*FilterExpressionParser) ExitPredicateExpression ¶
func (fep *FilterExpressionParser) ExitPredicateExpression(context *parser.PredicateExpressionContext)
ExitPredicateExpression is called when production predicateExpression is exited. gocyclo: ignore
func (*FilterExpressionParser) ExitValueExpression ¶
func (fep *FilterExpressionParser) ExitValueExpression(context *parser.ValueExpressionContext)
ExitValueExpression is called when production valueExpression is exited. gocyclo: ignore
func (*FilterExpressionParser) ExpressionTrees ¶
func (fep *FilterExpressionParser) ExpressionTrees() ([]*ExpressionTree, error)
ExpressionTrees gets the expression trees, parsing the filter expression if needed.
func (*FilterExpressionParser) FilterExpressionStatementCount ¶
func (fep *FilterExpressionParser) FilterExpressionStatementCount() int
FilterExpressionStatementCount gets the number filter expression statements encountered while parsing.
func (*FilterExpressionParser) FilteredRowSet ¶
func (fep *FilterExpressionParser) FilteredRowSet() DataRowHashSet
FilteredRowSet gets the unique row set matching the parsed filter expression.
func (*FilterExpressionParser) FilteredRows ¶
func (fep *FilterExpressionParser) FilteredRows() []*DataRow
FilteredRows gets the rows matching the parsed filter expression. Results could contain duplicates if source DataSet has duplicated rows.
func (*FilterExpressionParser) FilteredSignalIDSet ¶
func (fep *FilterExpressionParser) FilteredSignalIDSet() guid.HashSet
FilteredSignalIDSet gets the unique Guid-based signalID set matching the parsed filter expression.
func (*FilterExpressionParser) FilteredSignalIDs ¶
func (fep *FilterExpressionParser) FilteredSignalIDs() []guid.Guid
FilteredSignalIDs gets the Guid-based signalIDs matching the parsed filter expression. Results could contain duplicates if source DataSet has duplicated signalIDs.
func (*FilterExpressionParser) SetParsingExceptionCallback ¶
func (fep *FilterExpressionParser) SetParsingExceptionCallback(callback func(message string))
SetParsingExceptionCallback registers a callback for receiving parsing exception messsages.
func (*FilterExpressionParser) Table ¶
func (fep *FilterExpressionParser) Table(tableName string) (*DataTable, error)
Table gets the DataTable for the specified tableName from the FilterExpressionParser DataSet. An error will be returned if no DataSet has been defined or the tableName cannot be found.
type FunctionExpression ¶
type FunctionExpression struct {
// contains filtered or unexported fields
}
FunctionExpression represents a function expression.
func GetFunctionExpression ¶
func GetFunctionExpression(expression Expression) (*FunctionExpression, error)
GetFunctionExpression gets the expression cast to a FunctionExpression. An error will be returned if expression is nil or not ExpressionType.Function.
func NewFunctionExpression ¶
func NewFunctionExpression(functionType ExpressionFunctionTypeEnum, arguments []Expression) *FunctionExpression
NewFunctionExpression creates a new function expression.
func (*FunctionExpression) Arguments ¶
func (fe *FunctionExpression) Arguments() []Expression
Arguments gets the expression arguments of the FunctionExpression.
func (*FunctionExpression) FunctionType ¶
func (fe *FunctionExpression) FunctionType() ExpressionFunctionTypeEnum
FunctionType gets function type of the FunctionExpression.
func (*FunctionExpression) Type ¶
func (*FunctionExpression) Type() ExpressionTypeEnum
Type gets expression type of the FunctionExpression.
type InListExpression ¶
type InListExpression struct {
// contains filtered or unexported fields
}
InListExpression represents an in-list expression.
func GetInListExpression ¶
func GetInListExpression(expression Expression) (*InListExpression, error)
GetInListExpression gets the expression cast to a InListExpression. An error will be returned if expression is nil or not ExpressionType.InList.
func NewInListExpression ¶
func NewInListExpression(value Expression, arguments []Expression, hasNotkeyWord, exactMatch bool) *InListExpression
NewInListExpression creates a new in-list expression.
func (*InListExpression) Arguments ¶
func (ile *InListExpression) Arguments() []Expression
Arguments gets the expression arguments of the InListExpression.
func (*InListExpression) ExtactMatch ¶
func (ile *InListExpression) ExtactMatch() bool
ExtactMatch gets a flags that determines if the InListExpression has the "BINARY" or "===" keyword.
func (*InListExpression) HasNotKeyword ¶
func (ile *InListExpression) HasNotKeyword() bool
HasNotKeyword gets a flag that determines if the InListExpression has the "NOT" keyword.
func (*InListExpression) Type ¶
func (*InListExpression) Type() ExpressionTypeEnum
Type gets expression type of the InListExpression.
func (*InListExpression) Value ¶
func (ile *InListExpression) Value() Expression
Value gets the expression value of the InListExpression.
type OperatorExpression ¶
type OperatorExpression struct {
// contains filtered or unexported fields
}
OperatorExpression represents an operator expression.
func GetOperatorExpression ¶
func GetOperatorExpression(expression Expression) (*OperatorExpression, error)
GetOperatorExpression gets the expression cast to a OperatorExpression. An error will be returned if expression is nil or not ExpressionType.Operator.
func NewOperatorExpression ¶
func NewOperatorExpression(operatorType ExpressionOperatorTypeEnum, leftValue, rightValue Expression) *OperatorExpression
NewOperatorExpression creates a new operator expression.
func (*OperatorExpression) LeftValue ¶
func (oe *OperatorExpression) LeftValue() Expression
LeftValue gets the left value expression of the OperatorExpression.
func (*OperatorExpression) OperatorType ¶
func (oe *OperatorExpression) OperatorType() ExpressionOperatorTypeEnum
OperatorType gets operator type of the OperatorExpression.
func (*OperatorExpression) RightValue ¶
func (oe *OperatorExpression) RightValue() Expression
RightValue gets the right value expression of the OperatorExpression.
func (*OperatorExpression) Type ¶
func (*OperatorExpression) Type() ExpressionTypeEnum
Type gets expression type of the OperatorExpression.
type OrderByTerm ¶
type OrderByTerm struct { // Column is the data column reference of the OrderByTerm. Column *DataColumn // Ascending is a flag that determines if the OrderByTerm is sorted in ascending order. Ascending bool // ExactMatch is a flag that determines if the OrderByTerm used an exact match comparison. ExactMatch bool }
OrderByTerm represents the elements parsed from a column specified in the "ORDER BY" keyword.
type TableIDFields ¶
type TableIDFields struct { // SignalIDFieldName defines the field name of the signal ID field, type Guid. // Common value is "SignalID". SignalIDFieldName string // MeasurementKeyFieldName defines the name of the measurement key field // (format like "instance:id"), type string. Common value is "ID". MeasurementKeyFieldName string // PointTagFieldName defines the name of the point tag field, type string. // Common value is "PointTag". PointTagFieldName string }
TableIDFields represents the primary identification field names for a metadata table that is being used as the source for an STTP filter expression. See: https://sttp.github.io/documentation/filter-expressions/#activemeasurements
type TimeIntervalEnum ¶
type TimeIntervalEnum int
TimeIntervalEnum defines the type of the TimeInterval enumeration.
func ParseTimeInterval ¶
func ParseTimeInterval(name string) (TimeIntervalEnum, error)
ParseTimeInterval gets the TimeInterval parsed from the specified name. Case insensitive.
type UnaryExpression ¶
type UnaryExpression struct {
// contains filtered or unexported fields
}
UnaryExpression represents a unary expression.
func GetUnaryExpression ¶
func GetUnaryExpression(expression Expression) (*UnaryExpression, error)
GetUnaryExpression gets the expression cast to a UnaryExpression. An error will be returned if expression is nil or not ExpressionType.Unary.
func NewUnaryExpression ¶
func NewUnaryExpression(unaryType ExpressionUnaryTypeEnum, value Expression) *UnaryExpression
NewUnaryExpression creates a new unary expression.
func (*UnaryExpression) Type ¶
func (*UnaryExpression) Type() ExpressionTypeEnum
Type gets expression type of the UnaryExpression.
func (*UnaryExpression) UnaryType ¶
func (ue *UnaryExpression) UnaryType() ExpressionUnaryTypeEnum
UnaryType gets unary type of the UnaryExpression.
func (*UnaryExpression) Value ¶
func (ue *UnaryExpression) Value() Expression
Value gets the expression value of the UnaryExpression.
type ValueExpression ¶
type ValueExpression struct {
// contains filtered or unexported fields
}
ValueExpression represents a value expression.
var EmptyString *ValueExpression = newValueExpression(ExpressionValueType.String, "")
EmptyString is a value expression of type string with a value of an empty string.
var False *ValueExpression = newValueExpression(ExpressionValueType.Boolean, false)
False is a value expression of type boolean with a false value.
var True *ValueExpression = newValueExpression(ExpressionValueType.Boolean, true)
True is a value expression of type boolean with a true value.
func EvaluateDataRowExpression ¶
func EvaluateDataRowExpression(dataRow *DataRow, filterExpression string, suppressConsoleErrorOutput bool) (*ValueExpression, error)
EvaluateDataRowExpression returns the result of the evaluated filterExpression using the specified dataRow. If filterExpression contains multiple semi-colon separated statements, only the first expression is evaluated. An error will be returned if dataRow parameter is nil, the filterExpression is empty, expression fails to parse or row expresssion evaluation fails.
func EvaluateExpression ¶
func EvaluateExpression(filterExpression string, suppressConsoleErrorOutput bool) (*ValueExpression, error)
EvaluateExpression returns the result of the evaluated filterExpression. This expression evaluation function is only for simple expressions that do not reference any DataSet columns. Use EvaluateDataRowExpression for evaluating filter expressions that contain column references. If filterExpression contains multiple semi-colon separated statements, only the first expression is evaluated. An error will be returned if the filterExpression is empty or expression fails to parse.
func GetValueExpression ¶
func GetValueExpression(expression Expression) (*ValueExpression, error)
GetValueExpression gets the expression cast to a ValueExpression. An error will be returned if expression is nil or not ExpressionType.Value.
func NewValueExpression ¶
func NewValueExpression(valueType ExpressionValueTypeEnum, value interface{}) *ValueExpression
NewValueExpression creates a new value expression.
func NullValue ¶
func NullValue(targetValueType ExpressionValueTypeEnum) *ValueExpression
NullValue gets the target expression value type with a value of nil.
func (*ValueExpression) BooleanValue ¶
func (ve *ValueExpression) BooleanValue() (bool, error)
BooleanValue gets the ValueExpression value cast as a bool. An error will be returned if value type is not ExpressionValueType.Boolean.
func (*ValueExpression) Convert ¶
func (ve *ValueExpression) Convert(targetValueType ExpressionValueTypeEnum) (*ValueExpression, error)
Convert attempts to convert the ValueExpression to the specified targetValueType.
func (*ValueExpression) DateTimeValue ¶
func (ve *ValueExpression) DateTimeValue() (time.Time, error)
DateTimeValue gets the ValueExpression value cast as a time.Time. An error will be returned if value type is not ExpressionValueType.DateTime.
func (*ValueExpression) DecimalValue ¶
func (ve *ValueExpression) DecimalValue() (decimal.Decimal, error)
DecimalValue gets the ValueExpression value cast as a decimal.Decimal. An error will be returned if value type is not ExpressionValueType.Decimal.
func (*ValueExpression) DoubleValue ¶
func (ve *ValueExpression) DoubleValue() (float64, error)
DoubleValue gets the ValueExpression value cast as a float64. An error will be returned if value type is not ExpressionValueType.Double.
func (*ValueExpression) GuidValue ¶
func (ve *ValueExpression) GuidValue() (guid.Guid, error)
GuidValue gets the ValueExpression value cast as a guid.Guid. An error will be returned if value type is not ExpressionValueType.Guid.
func (*ValueExpression) Int32Value ¶
func (ve *ValueExpression) Int32Value() (int32, error)
Int32Value gets the ValueExpression value cast as an int32. An error will be returned if value type is not ExpressionValueType.Int32.
func (*ValueExpression) Int64Value ¶
func (ve *ValueExpression) Int64Value() (int64, error)
Int64Value gets the ValueExpression value cast as an int64. An error will be returned if value type is not ExpressionValueType.Int64.
func (*ValueExpression) IsNull ¶
func (ve *ValueExpression) IsNull() bool
IsNull gets a flag that determines if the ValueExpression value is null.
func (*ValueExpression) String ¶
func (ve *ValueExpression) String() string
String gets the ValueExpression value as a string.
func (*ValueExpression) StringValue ¶
func (ve *ValueExpression) StringValue() (string, error)
StringValue gets the ValueExpression value cast as a string. An error will be returned if value type is not ExpressionValueType.String.
func (*ValueExpression) Type ¶
func (*ValueExpression) Type() ExpressionTypeEnum
Type gets expression type of the ValueExpression.
func (*ValueExpression) Value ¶
func (ve *ValueExpression) Value() interface{}
Value gets the value of a ValueExpression.
func (*ValueExpression) ValueType ¶
func (ve *ValueExpression) ValueType() ExpressionValueTypeEnum
ValueType gets data type of the value of a ValueExpression.
Source Files ¶
- CallbackErrorListener.go
- ColumnExpression.go
- Constants.go
- DataColumn.go
- DataRow.go
- DataRowHashSet.go
- DataSet.go
- DataTable.go
- DataType.go
- Expression.go
- ExpressionTree.go
- FilterExpressionParser.go
- FunctionExpression.go
- InListExpression.go
- OperatorExpression.go
- OrderByTerm.go
- TableIDFields.go
- UnaryExpression.go
- ValueExpression.go