Documentation ¶
Index ¶
- type ArithmeticCol
- type ArithmeticOperatorType
- type Clause
- type Column
- type ColumnType
- type DBType
- type DataSource
- type DataSourceType
- type Dimension
- type DimensionType
- type ExpressionCol
- type FieldProperty
- type Filter
- type FilterOperatorType
- type Join
- type JoinOn
- type Limit
- type Metric
- type MetricType
- type NormalClause
- type OrderBy
- type OrderDirectionType
- type Query
- type Result
- type SingleCol
- type SqlClause
- type Statement
- type TimeInterval
- type ValueType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArithmeticCol ¶
type ArithmeticCol struct { Column []Column `json:"column"` Alias string `json:"alias"` Type ColumnType `json:"type"` }
func (*ArithmeticCol) GetAlias ¶
func (col *ArithmeticCol) GetAlias() string
func (*ArithmeticCol) GetExpression ¶
func (col *ArithmeticCol) GetExpression() string
type ArithmeticOperatorType ¶
type ArithmeticOperatorType string
const ( ArithmeticOperatorTypeAdd ArithmeticOperatorType = "+" ArithmeticOperatorTypeSubtract ArithmeticOperatorType = "-" ArithmeticOperatorTypeMultiply ArithmeticOperatorType = "*" ArithmeticOperatorTypeDivide ArithmeticOperatorType = "/" ArithmeticOperatorTypeAs ArithmeticOperatorType = "as" )
type ColumnType ¶
type ColumnType string
const ( ColumnTypeValue ColumnType = "value" ColumnTypeCount ColumnType = "count" ColumnTypeDistinctCount ColumnType = "distinct_count" ColumnTypeSum ColumnType = "sum" ColumnTypeAdd ColumnType = "add" ColumnTypeSubtract ColumnType = "subtract" ColumnTypeMultiply ColumnType = "multiply" ColumnTypeDivide ColumnType = "divide" ColumnTypeAs ColumnType = "as" )
type DataSource ¶
type DataSource struct { Database string `json:"database"` Name string `json:"name"` AliasName string `json:"alias"` Type DataSourceType `json:"type"` Clause Clause `json:"clause"` // contains filtered or unexported fields }
func (*DataSource) Alias ¶
func (d *DataSource) Alias() (string, error)
func (*DataSource) Expression ¶
func (d *DataSource) Expression() (string, error)
func (*DataSource) Statement ¶
func (d *DataSource) Statement() (string, error)
type DataSourceType ¶
type DataSourceType string
const ( DataSourceTypeFact DataSourceType = "fact" DataSourceTypeDimension DataSourceType = "dimension" DataSourceTypeFactDimensionJoin DataSourceType = "fact_dimension_join" DataSourceTypeMergeJoin DataSourceType = "merge_join" )
type Dimension ¶
type Dimension struct { Table string `json:"table"` Name string `json:"name"` FieldName string `json:"field_name"` Type DimensionType `json:"type"` ValueType ValueType `json:"value_type"` Dependency []*Dimension `json:"dependency"` }
func (*Dimension) Expression ¶
type DimensionType ¶
type DimensionType string
const ( DimensionTypeValue DimensionType = "DIMENSION_VALUE" DimensionTypeSingle DimensionType = "DIMENSION_SINGLE" DimensionTypeMulti DimensionType = "DIMENSION_MULTI" DimensionTypeCase DimensionType = "DIMENSION_CASE" DimensionTypeExpression DimensionType = "DIMENSION_EXPRESSION" )
type ExpressionCol ¶
func (*ExpressionCol) GetAlias ¶
func (col *ExpressionCol) GetAlias() string
func (*ExpressionCol) GetExpression ¶
func (col *ExpressionCol) GetExpression() string
type FieldProperty ¶
type FieldProperty string
const ( FieldPropertyDimension FieldProperty = "DIMENSION" FieldPropertyMetric FieldProperty = "METRIC" )
type Filter ¶
type Filter struct { OperatorType FilterOperatorType `toml:"operator_type" json:"operator_type"` ValueType ValueType `toml:"value_type" json:"value_type"` Table string `toml:"table" json:"table"` Name string `toml:"name" json:"name"` FieldProperty FieldProperty `toml:"field_property" json:"field_property"` Value []any `toml:"value" json:"value"` Children []*Filter `toml:"children" json:"children"` }
func (*Filter) Expression ¶
type FilterOperatorType ¶
type FilterOperatorType string
const ( FilterOperatorTypeUnknown FilterOperatorType = "FILTER_OPERATOR_UNKNOWN" FilterOperatorTypeEquals FilterOperatorType = "FILTER_OPERATOR_EQUALS" FilterOperatorTypeIn FilterOperatorType = "FILTER_OPERATOR_IN" FilterOperatorTypeNotIn FilterOperatorType = "FILTER_OPERATOR_NOT_IN" FilterOperatorTypeLessEquals FilterOperatorType = "FILTER_OPERATOR_LESS_EQUALS" FilterOperatorTypeLess FilterOperatorType = "FILTER_OPERATOR_LESS" FilterOperatorTypeGreaterEquals FilterOperatorType = "FILTER_OPERATOR_GREATER_EQUALS" FilterOperatorTypeGreater FilterOperatorType = "FILTER_OPERATOR_GREATER" FilterOperatorTypeLike FilterOperatorType = "FILTER_OPERATOR_LIKE" FilterOperatorTypeHas FilterOperatorType = "FILTER_OPERATOR_HAS" FilterOperatorTypeExpression FilterOperatorType = "FILTER_OPERATOR_EXTENSION" FilterOperatorTypeAnd FilterOperatorType = "FILTER_OPERATOR_AND" FilterOperatorTypeOr FilterOperatorType = "FILTER_OPERATOR_OR" )
func (FilterOperatorType) IsTree ¶
func (f FilterOperatorType) IsTree() bool
type Join ¶
type Join struct { DataSource1 *DataSource `json:"datasource1"` DataSource2 *DataSource `json:"datasource2"` JoinType string `json:"join_type"` On []*JoinOn `json:"on"` Filters []*Filter `json:"filters"` }
func (*Join) GetJoinType ¶
type Metric ¶
type Metric struct { Table string `json:"table"` Name string `json:"name"` Type MetricType `json:"type"` FieldName string `json:"field_name"` ValueType ValueType `json:"value_type"` Children []*Metric `json:"children"` Filter *Filter `json:"filter"` DBType DBType `json:"db_type"` }
func (*Metric) Expression ¶
type MetricType ¶
type MetricType string
const ( MetricTypeUnknown MetricType = "METRIC_UNKNOWN" // invalid type. MetricTypeValue MetricType = "METRIC_VALUE" // single type. eg: 原始值指标 MetricTypeCount MetricType = "METRIC_COUNT" // single type. eg: 计数指标 MetricTypeDistinctCount MetricType = "METRIC_DISTINCT_COUNT" // single type. eg: 去重计数指标 MetricTypeSum MetricType = "METRIC_SUM" // single type. eg: 求和指标 MetricTypeAdd MetricType = "METRIC_ADD" // composition type eg: 相加指标 MetricTypeSubtract MetricType = "METRIC_SUBTRACT" // composition type eg: 相乘指标 MetricTypeMultiply MetricType = "METRIC_MULTIPLY" // composition type eg: 相减指标 MetricTypeDivide MetricType = "METRIC_DIVIDE" // composition type.eg: 相除指标 MetricTypeAs MetricType = "METRIC_AS" // composition type eg: 关联指标 MetricTypeExpression MetricType = "METRIC_EXPRESSION" // single type. eg: 表达式 )
type NormalClause ¶
type NormalClause struct { Metrics []*Metric `json:"metrics"` Dimensions []*Dimension `json:"dimensions"` Filters []*Filter `json:"filters"` Joins []*Join `json:"joins"` Orders []*OrderBy `json:"orders"` Limit *Limit `json:"limit"` DataSource []*DataSource `json:"data_source"` // contains filtered or unexported fields }
func (*NormalClause) GetDataset ¶
func (b *NormalClause) GetDataset() string
type OrderBy ¶
type OrderBy struct { Table string `json:"table"` Name string `json:"name"` FieldProperty FieldProperty `json:"field_property"` Direction OrderDirectionType `json:"direction"` }
func (*OrderBy) Expression ¶
type OrderDirectionType ¶
type OrderDirectionType string
const ( OrderDirectionTypeUnknown OrderDirectionType = "ORDER_DIRECTION_UNKNOWN" OrderDirectionTypeAscending OrderDirectionType = "ORDER_DIRECTION_ASCENDING" OrderDirectionTypeDescending OrderDirectionType = "ORDER_DIRECTION_DESCENDING" )
type Query ¶
type Query struct { DataSetName string `json:"data_set_name"` TimeInterval *TimeInterval `json:"time_interval"` Metrics []string `json:"metrics"` Dimensions []string `json:"dimensions"` Filters []*Filter `json:"filters"` Orders []*OrderBy `json:"orders"` Limit *Limit `json:"limit"` Sql string `json:"Sql"` }
func (*Query) TranslateTimeIntervalToFilter ¶
func (q *Query) TranslateTimeIntervalToFilter()
type Result ¶
type Result struct { Dimensions []string `json:"dimensions"` Source []map[string]any `json:"source"` }
func (*Result) SetDimensions ¶
type SingleCol ¶
type SingleCol struct { DBType DBType `json:"db_type"` Table string `json:"table"` Name string `json:"name"` Alias string `json:"alias"` Type ColumnType `json:"type"` Filter *Filter `json:"filter"` }
func (*SingleCol) GetExpression ¶
func (*SingleCol) GetIfExpression ¶
type SqlClause ¶
type SqlClause struct { Sql string // contains filtered or unexported fields }
func (*SqlClause) GetDataset ¶
func (b *SqlClause) GetDataset() string
type TimeInterval ¶
type TimeInterval struct { Name string `json:"name"` Start string `json:"start"` End string `json:"end"` }
func (*TimeInterval) ToFilter ¶
func (t *TimeInterval) ToFilter() *Filter
Click to show internal directories.
Click to hide internal directories.