Documentation ¶
Index ¶
- Constants
- Variables
- type AllPartitionFilter
- type CustomFilterExpression
- type DataType
- type Date
- type DateTrunc
- type Expression
- type FieldIdentifier
- type FilterClause
- type FromClause
- type GroupByClause
- type GroupByExpression
- type MetricExpression
- type MetricExpressionList
- type MetricType
- type NoFilter
- type NoGroupBy
- type PartitionFilter
- type Query
- type SelectExpression
- type SelectExpressionList
- type TimestampTrunc
- type TimestampValue
- type TruncType
- type Unnest
Constants ¶
const ( //DataTypeTimestamp is timestamp datatype DataTypeTimestamp = "TIMESTAMP" //DataTypeDate is date datatype DataTypeDate = "DATE" )
const ( //MetricTypeCount is metric type of count MetricTypeCount = "COUNT" //MetricTypeNullCount is metric type of null count MetricTypeNullCount = "NULLCOUNT" //MetricTypeSum is metric type of sum MetricTypeSum = "SUM" //MetricTypeCountForRepeated is metric type of count MetricTypeCountForRepeated = "COUNTFORREPEATED" //MetricTypeNullCountForRepeated is metric type of count MetricTypeNullCountForRepeated = "NULLCOUNTFORREPEATED" //MetricTypeUniqueCount is metric type of unique count MetricTypeUniqueCount = "UNIQUECOUNT" //MetricTypeInvalidCount is metric type of invalid count MetricTypeInvalidCount = "INVALIDCOUNT" )
Variables ¶
var ErrorMetricTypeNotFound = errors.New("error : Metric type is not found")
ErrorMetricTypeNotFound is error when metric type is undefined, or not found from the list
Functions ¶
This section is empty.
Types ¶
type AllPartitionFilter ¶
type AllPartitionFilter struct {
PartitionColumn string
}
AllPartitionFilter is used to select all partition data
func (*AllPartitionFilter) Build ¶
func (af *AllPartitionFilter) Build() string
Build all partition filter clause
func (*AllPartitionFilter) Equal ¶
func (af *AllPartitionFilter) Equal(other FilterClause) bool
Equal implementation
type CustomFilterExpression ¶
type CustomFilterExpression struct {
Expression string
}
CustomFilterExpression filter by custom expression
func (*CustomFilterExpression) Build ¶
func (c *CustomFilterExpression) Build() string
func (*CustomFilterExpression) Equal ¶
func (c *CustomFilterExpression) Equal(other FilterClause) bool
type DateTrunc ¶
type DateTrunc struct { Target Expression TruncateType TruncType }
DateTrunc is type of DATE_TRUNC() function in bigquery SQL syntax
type Expression ¶
Expression is any expression
type FieldIdentifier ¶
type FieldIdentifier struct {
FieldID string
}
func (*FieldIdentifier) Build ¶
func (f *FieldIdentifier) Build() (string, error)
type FilterClause ¶
type FilterClause interface { Build() string Equal(other FilterClause) bool // contains filtered or unexported methods }
FilterClause interface of types intended to do filter in where clause
type FromClause ¶
FromClause is a definition of from clause in sql
func (*FromClause) Build ¶
func (fc *FromClause) Build() string
Build is a method to build from clause sql string
type GroupByClause ¶
type GroupByClause interface { Build() string // contains filtered or unexported methods }
GroupByClause builder of group by expression
type GroupByExpression ¶
type GroupByExpression struct {
Expression string
}
GroupByExpression is group by any kind of expression an Expression can be a column for example : GROUP BY created_date or can be an select expression for example : GROUP BY date(created_timestamp)
func (*GroupByExpression) Build ¶
func (g *GroupByExpression) Build() string
Build build group by expression based on groupByTemplate template
type MetricExpression ¶
type MetricExpression struct { Arg string Alias string MetricType MetricType }
MetricExpression is definition type of calculation, and the alias produced of from a column
func NewMetricExpression ¶
func NewMetricExpression(arg string, alias string, metricType MetricType) *MetricExpression
NewMetricExpression is constructor for metric expression
func (*MetricExpression) Build ¶
func (m *MetricExpression) Build() (string, error)
Build is process of constructing script from metric definition
type MetricExpressionList ¶
type MetricExpressionList []*MetricExpression
MetricExpressionList list of metric expression
func (MetricExpressionList) Build ¶
func (m MetricExpressionList) Build() (string, error)
Build build each metric expression and join them
type MetricType ¶
type MetricType string
MetricType is type of metric
func ParseMetricType ¶
func ParseMetricType(_type metric.Type, mode meta.Mode) MetricType
ParseMetricType to parse metric name to metric type
type PartitionFilter ¶
PartitionFilter is filter for select data based on partition column
func (*PartitionFilter) Build ¶
func (pf *PartitionFilter) Build() string
Build is a method to build sql expression of filtering based on partition
func (*PartitionFilter) Equal ¶
func (pf *PartitionFilter) Equal(other FilterClause) bool
Equal implementation
type Query ¶
type Query struct { Expressions SelectExpressionList Metrics MetricExpressionList From *FromClause Where FilterClause //GroupBy is optional GroupBy GroupByClause }
Query is an SQL query
type SelectExpression ¶
func (*SelectExpression) Build ¶
func (s *SelectExpression) Build() string
type SelectExpressionList ¶
type SelectExpressionList []*SelectExpression
func (SelectExpressionList) Build ¶
func (s SelectExpressionList) Build() string
type TimestampTrunc ¶
type TimestampTrunc struct { TimestampExpr Expression TruncateType TruncType Timezone *time.Location }
func (*TimestampTrunc) Build ¶
func (t *TimestampTrunc) Build() (string, error)
type TimestampValue ¶
type TimestampValue struct {
Value string
}
func (*TimestampValue) Build ¶
func (t *TimestampValue) Build() (string, error)
type TruncType ¶
type TruncType string
TruncType is trunc type of date_trunc() and timestamp_trunc() function
var TruncTypeDay TruncType = "DAY"
var TruncTypeHour TruncType = "HOUR"
var TruncTypeMonth TruncType = "MONTH"
var TruncTypeYear TruncType = "YEAR"