Documentation ¶
Index ¶
- Constants
- type AggregatedValues
- type Aggregation
- type AggregationKind
- type AnalysisDB
- type AnalysisQuery
- type AnalysisResult
- func (analysisResult *AnalysisResult) Finalize() error
- func (analysisResult *AnalysisResult) GetOrCreateRowResult(handle ResultHandle) (rowResult RowResult, err error)
- func (analysisResult *AnalysisResult) InitializeColumnResult(handle ResultHandle) (columnIndex int, err error)
- func (analysisResult *AnalysisResult) NewResultHandle() (handle ResultHandle, err error)
- func (analysisResult *AnalysisResult) ParseResultHandle(handle ResultHandle) error
- type Column
- type ColumnResult
- type DBValue
- type DataSource
- type DataType
- type DateInterval
- type ResultHandle
- type RowResult
- type SortOrder
- type Split
- type StoredTableSchema
- type TableSchema
- func (schema TableSchema) ConvertAndAppendRow(convertedRow []any, rawRow []string) ([]any, error)
- func (schema TableSchema) ConvertRowToMap(rawRow []string) (map[string]any, error)
- func (schema TableSchema) DeduceDataTypesFromRow(row []string) error
- func (schema TableSchema) ToStored() StoredTableSchema
- func (schema TableSchema) Validate() error
- func (schema TableSchema) ValidateColumns() []error
Constants ¶
View Source
const ( StoredSchemasTable = "analysis_schemas" StoredSchemaName = "table_name" StoredSchemaColumnNames = "column_names" StoredSchemaColumnDataTypes = "column_data_types" StoredSchemaColumnOptionals = "column_optionals" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregatedValues ¶
type AggregatedValues interface { Insert(index int, item any) (ok bool) InsertZero(index int) AddZeroesUpToLength(length int) Total(dataType DataType) (DBValue, error) Truncate(maxLength int) }
func NewAggregatedValues ¶
func NewAggregatedValues(dataType DataType, capacity int) (AggregatedValues, error)
type Aggregation ¶
type Aggregation struct { Kind AggregationKind `json:"kind"` FieldName string `json:"fieldName"` DataType DataType `json:"dataType"` }
type AggregationKind ¶
type AggregationKind int8
const ( AggregationSum AggregationKind = iota + 1 AggregationAverage AggregationMin AggregationMax AggregationCount )
func (AggregationKind) IsValid ¶
func (kind AggregationKind) IsValid() bool
func (AggregationKind) MarshalJSON ¶
func (kind AggregationKind) MarshalJSON() ([]byte, error)
func (AggregationKind) String ¶
func (kind AggregationKind) String() string
func (*AggregationKind) UnmarshalJSON ¶
func (kind *AggregationKind) UnmarshalJSON(bytes []byte) error
type AnalysisDB ¶
type AnalysisDB interface { RunAnalysisQuery( ctx context.Context, analysis AnalysisQuery, table string, ) (AnalysisResult, error) CreateTable(ctx context.Context, schema TableSchema) error IngestData(ctx context.Context, data DataSource, schema TableSchema) error DropTable(ctx context.Context, table string) (alreadyDropped bool, err error) CreateStoredSchemasTable(ctx context.Context) error StoreTableSchema(ctx context.Context, schema TableSchema) error GetTableSchema(ctx context.Context, table string) (TableSchema, error) DeleteTableSchema(ctx context.Context, table string) error }
type AnalysisQuery ¶
type AnalysisQuery struct { Aggregation Aggregation `json:"aggregation"` RowSplit Split `json:"rowSplit"` ColumnSplit Split `json:"columnSplit"` }
type AnalysisResult ¶
type AnalysisResult struct { Rows []RowResult `json:"rows"` RowsMeta Split `json:"rowsMeta"` Columns []ColumnResult `json:"columns"` ColumnsMeta Split `json:"columnsMeta"` AggregationDataType DataType `json:"aggregationDataType"` }
func NewAnalysisQueryResult ¶
func NewAnalysisQueryResult(analysis AnalysisQuery) AnalysisResult
func (*AnalysisResult) Finalize ¶
func (analysisResult *AnalysisResult) Finalize() error
func (*AnalysisResult) GetOrCreateRowResult ¶
func (analysisResult *AnalysisResult) GetOrCreateRowResult( handle ResultHandle, ) (rowResult RowResult, err error)
func (*AnalysisResult) InitializeColumnResult ¶
func (analysisResult *AnalysisResult) InitializeColumnResult( handle ResultHandle, ) (columnIndex int, err error)
func (*AnalysisResult) NewResultHandle ¶
func (analysisResult *AnalysisResult) NewResultHandle() (handle ResultHandle, err error)
func (*AnalysisResult) ParseResultHandle ¶
func (analysisResult *AnalysisResult) ParseResultHandle(handle ResultHandle) error
type Column ¶
type ColumnResult ¶
type ColumnResult struct {
FieldValue DBValue `json:"fieldValue"`
}
type DBValue ¶
type DBValue interface { Value() any Pointer() any Set(value any) (ok bool) Equals(value any) bool LessThan(value any) (less bool, err error) }
func NewDBValue ¶
type DataSource ¶
type DataType ¶
type DataType int8
func (DataType) IsValidForAggregation ¶
func (DataType) MarshalJSON ¶
func (*DataType) UnmarshalJSON ¶
type DateInterval ¶
type DateInterval int8
const ( DateIntervalYear DateInterval = iota + 1 DateIntervalQuarter DateIntervalMonth DateIntervalWeek DateIntervalDay )
func (DateInterval) IsNone ¶
func (dateInterval DateInterval) IsNone() bool
func (DateInterval) IsValid ¶
func (dateInterval DateInterval) IsValid() bool
func (DateInterval) MarshalJSON ¶
func (dateInterval DateInterval) MarshalJSON() ([]byte, error)
func (DateInterval) String ¶
func (dateInterval DateInterval) String() string
func (*DateInterval) UnmarshalJSON ¶
func (dateInterval *DateInterval) UnmarshalJSON(data []byte) error
type ResultHandle ¶
type RowResult ¶
type RowResult struct { FieldValue DBValue `json:"fieldValue"` AggregationTotal DBValue `json:"aggregationTotal"` AggregationsByColumn AggregatedValues `json:"aggregationsByColumn"` }
type SortOrder ¶
type SortOrder int8
func (SortOrder) MarshalJSON ¶
func (*SortOrder) UnmarshalJSON ¶
type Split ¶
type Split struct { FieldName string `json:"fieldName"` DataType DataType `json:"dataType"` Limit int `json:"limit"` SortOrder SortOrder `json:"sortOrder"` // May only be present if DataType is INTEGER. IntegerInterval int `json:"integerInterval,omitempty"` // May only be present if DataType is FLOAT. FloatInterval float64 `json:"floatInterval,omitempty"` // May only be present if DataType is DATETIME. DateInterval DateInterval `json:"dateInterval,omitempty"` }
type StoredTableSchema ¶
type StoredTableSchema struct { TableName string `json:"table_name"` ColumnNames []string `json:"column_names"` DataTypes []int8 `json:"column_data_types"` Optionals []bool `json:"column_optionals"` }
func (StoredTableSchema) ToSchema ¶
func (storedSchema StoredTableSchema) ToSchema() (TableSchema, error)
type TableSchema ¶
func NewTableSchema ¶
func NewTableSchema(columnNames []string) TableSchema
func (TableSchema) ConvertAndAppendRow ¶
func (schema TableSchema) ConvertAndAppendRow(convertedRow []any, rawRow []string) ([]any, error)
func (TableSchema) ConvertRowToMap ¶
func (schema TableSchema) ConvertRowToMap(rawRow []string) (map[string]any, error)
func (TableSchema) DeduceDataTypesFromRow ¶
func (schema TableSchema) DeduceDataTypesFromRow(row []string) error
func (TableSchema) ToStored ¶
func (schema TableSchema) ToStored() StoredTableSchema
func (TableSchema) Validate ¶
func (schema TableSchema) Validate() error
func (TableSchema) ValidateColumns ¶
func (schema TableSchema) ValidateColumns() []error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.