Documentation ¶
Overview ¶
Copyright 2022 Molecula Corp. (DBA FeatureBase). SPDX-License-Identifier: Apache-2.0
Copyright 2022 Molecula Corp. (DBA FeatureBase). SPDX-License-Identifier: Apache-2.0
Copyright 2022 Molecula Corp. (DBA FeatureBase). SPDX-License-Identifier: Apache-2.0
Copyright 2022 Molecula Corp. (DBA FeatureBase). SPDX-License-Identifier: Apache-2.0
Copyright 2022 Molecula Corp. (DBA FeatureBase). SPDX-License-Identifier: Apache-2.0
Copyright 2022 Molecula Corp. (DBA FeatureBase). SPDX-License-Identifier: Apache-2.0
Copyright 2022 Molecula Corp. (DBA FeatureBase). SPDX-License-Identifier: Apache-2.0
Copyright 2022 Molecula Corp. (DBA FeatureBase). SPDX-License-Identifier: Apache-2.0
Copyright 2022 Molecula Corp. (DBA FeatureBase). SPDX-License-Identifier: Apache-2.0
Copyright 2022 Molecula Corp. (DBA FeatureBase). SPDX-License-Identifier: Apache-2.0
Copyright 2021 Molecula Corp. All rights reserved.
Index ¶
- Constants
- Variables
- func All() string
- func ApplyValCountFunc(rowser pproto.ToRowser, fn FuncName) pproto.ToRowser
- func AssignHeaders(rowser pproto.ToRowser, headers ...Column) pproto.ToRowser
- func Between(fieldName string, a interface{}, b interface{}) string
- func ConstRow(ids ...interface{}) string
- func ConvertToTime(text string) (time.Time, bool)
- func Count(rowCall string) string
- func CountRows(rowser pproto.ToRowser) pproto.ToRowser
- func Distinct(indexName, fieldName, rowCall string) string
- func Equals(fieldName string, value interface{}) string
- func Extract(rowCall string, fields ...string) string
- func ExtractFieldName(columName string) (fieldName string, isSpecial bool)
- func GT(fieldName string, value interface{}) string
- func GTE(fieldName string, value interface{}) string
- func GroupByBase(rows []string, limit int64, filter, aggregate, having string) (string, error)
- func Intersect(rows ...string) string
- func LT(fieldName string, value interface{}) string
- func LTE(fieldName string, value interface{}) string
- func Like(fieldName string, pattern string) string
- func Limit(row string, limit uint, offset uint) string
- func LimitRows(rowser pproto.ToRowser, limit uint) pproto.ToRowser
- func Max(fieldName string, row string) string
- func Min(fieldName string, row string) string
- func Not(rows ...string) string
- func NotEquals(fieldName string, value interface{}) string
- func NotNull(fieldName string) string
- func Offset(row string, offset uint) string
- func OffsetRows(rowser pproto.ToRowser, offset uint) pproto.ToRowser
- func OrderBy(rowser pproto.ToRowser, fields, dirs []string) pproto.ToRowser
- func Row(fieldName string, rowIDOrKey interface{}) (string, error)
- func RowDistinct(indexName, fieldName string, row string) string
- func RowRange(fieldName string, rowIDOrKey interface{}, start time.Time, end time.Time) (string, error)
- func RowTopN(fieldName string, n uint64, row string) string
- func Rows(fieldName string) string
- func RowsLimit(fieldName string, limit int64) (string, error)
- func StaticHeaders(rowser pproto.ToRowser, cols ...Column) pproto.ToRowser
- func Sum(fieldName string, row string) string
- func TopN(fieldName string, n uint64) string
- func Union(rows ...string) string
- type BasicColumn
- type Column
- type DDLHandler
- type FieldColumn
- type FuncColumn
- type FuncName
- type HavingClause
- type IDIndexColumn
- type KeyIndexColumn
- type MappedSQL
- type Mapper
- type MappingResult
- type QueryMask
- func (m *QueryMask) ApplyFilter(f QueryMask) bool
- func (m *QueryMask) HasFrom() bool
- func (m *QueryMask) HasGroupBy() bool
- func (m *QueryMask) HasHaving() bool
- func (m *QueryMask) HasLimit() bool
- func (m *QueryMask) HasOrderBy() bool
- func (m *QueryMask) HasSelect() bool
- func (m *QueryMask) HasSelectPart(p selectPart) bool
- func (m *QueryMask) HasWhere() bool
- type SelectHandler
- type SelectProperties
- type ShowHandler
- type StarColumn
Constants ¶
const ( SQLTypeSelect = "select" SQLTypeShow = "show" SQLTypeSet = "set" SQLTypeBegin = "begin" SQLTypeEmpty = "" )
const ( SelectPartDistinct selectPart = 1 << iota SelectPartID SelectPartStar SelectPartField SelectPartFields SelectPartCountStar SelectPartCountField SelectPartCountDistinctField SelectPartMinField SelectPartMaxField SelectPartSumField SelectPartAvgField )
const ( FromPartTable fromPart = 1 << iota FromPartTables FromPartJoin )
const ( WherePartIDCondition wherePart = 1 << iota WherePartFieldCondition WherePartMultiFieldCondition )
const ( GroupByPartField groupByPart = 1 << iota GroupByPartFields )
const ( OrderByPartField orderByPart = 1 << iota OrderByPartFields )
const ( LimitPartLimit limitPart = 1 << iota LimitPartOffset )
const ColID = "_id"
const (
HavingPartCondition havingPart = 1 << iota
)
Variables ¶
var ( ErrIncompleteHeaders = errors.New("incomplete header assignment") ErrFieldNotInHeaders = errors.New("field not found in source header") )
var (
ErrMultipleSQLStatements = errors.New("statement contains multiple sql queries")
)
System errors.
var (
ErrUnsupportedQuery = errors.New("unsupported query")
)
Functions ¶
func ApplyValCountFunc ¶
ApplyValCountFunc converts a ValCount result to the proper result for Func
func AssignHeaders ¶
AssignHeaders assigns headers to a ToRowser.
func ConstRow ¶
func ConstRow(ids ...interface{}) string
ConstRow creates a query value that uses a list of columns in place of a Row query.
func Count ¶
Count creates a Count query. Returns the number of set columns in the ROW_CALL passed in.
func Extract ¶
Extract creates an Extract query. It accepts a bitmap query to select columns and a list of fields to select rows.
func ExtractFieldName ¶
func GroupByBase ¶
GroupByBase creates a GroupBy query with the given functional options.
func Like ¶
Like creates a Rows query filtered by a pattern. An underscore ('_') can be used as a placeholder for a single UTF-8 codepoint or a percent sign ('%') can be used as a placeholder for 0 or more codepoints. All other codepoints in the pattern are matched exactly.
func OffsetRows ¶
OffsetRows applies an offset to a ToRowser.
func RowDistinct ¶
RowDistinct creates a Distinct query with the given row filter.
func RowRange ¶
func RowRange(fieldName string, rowIDOrKey interface{}, start time.Time, end time.Time) (string, error)
RowRange is a Row query with from,to times
func RowTopN ¶
RowTopN creates a TopN query with the given item count and row. This variant supports customizing the row query.
func StaticHeaders ¶
StaticHeaders assigns fixed cols to a ToRowser.
Types ¶
type BasicColumn ¶
type BasicColumn struct {
// contains filtered or unexported fields
}
func NewBasicColumn ¶
func NewBasicColumn(s, n, a string) *BasicColumn
func (*BasicColumn) Alias ¶
func (b *BasicColumn) Alias() string
func (*BasicColumn) Name ¶
func (b *BasicColumn) Name() string
func (*BasicColumn) Source ¶
func (b *BasicColumn) Source() string
type Column ¶
Column is an interface which supports mapping to source headers, and aliasing column names. Alias() should always return a value; either a unique alias, or the same value return by Name(), but never an empty string.
type DDLHandler ¶
type DDLHandler struct {
// contains filtered or unexported fields
}
DDLHandler executes CREATE, ALTER, DROP, RENAME, TRUNCATE or ANALYZE statement.
type FieldColumn ¶
func NewFieldColumn ¶
func NewFieldColumn(field *pilosa.Field, alias string) *FieldColumn
func (*FieldColumn) Alias ¶
func (f *FieldColumn) Alias() string
func (*FieldColumn) Name ¶
func (f *FieldColumn) Name() string
func (*FieldColumn) Source ¶
func (f *FieldColumn) Source() string
type FuncColumn ¶
type FuncColumn struct { Field *pilosa.Field FuncName FuncName // contains filtered or unexported fields }
func NewFuncColumn ¶
func NewFuncColumn(funcName FuncName, field *pilosa.Field, alias string) *FuncColumn
func (*FuncColumn) Alias ¶
func (f *FuncColumn) Alias() string
func (*FuncColumn) Name ¶
func (f *FuncColumn) Name() string
func (*FuncColumn) Source ¶
func (f *FuncColumn) Source() string
type HavingClause ¶
type IDIndexColumn ¶
func NewIDIndexColumn ¶
func NewIDIndexColumn(index *pilosa.Index, alias string) *IDIndexColumn
func (*IDIndexColumn) Alias ¶
func (i *IDIndexColumn) Alias() string
func (*IDIndexColumn) Name ¶
func (i *IDIndexColumn) Name() string
func (*IDIndexColumn) Source ¶
func (i *IDIndexColumn) Source() string
type KeyIndexColumn ¶
KeyIndexColumn is a column for a keyed index. TODO: what the difference between this and IDIndexColumn?
func NewKeyIndexColumn ¶
func NewKeyIndexColumn(index *pilosa.Index, alias string) *KeyIndexColumn
func (*KeyIndexColumn) Alias ¶
func (i *KeyIndexColumn) Alias() string
func (*KeyIndexColumn) Name ¶
func (i *KeyIndexColumn) Name() string
func (*KeyIndexColumn) Source ¶
func (i *KeyIndexColumn) Source() string
type Mapper ¶
Mapper is responsible for mapping a SQL query to structure representation
type MappingResult ¶
type QueryMask ¶
type QueryMask struct { SelectMask selectPart FromMask fromPart WhereMask wherePart GroupByMask groupByPart HavingMask havingPart OrderByMask orderByPart LimitMask limitPart }
func GenerateMask ¶
func MustGenerateMask ¶
func NewQueryMask ¶
func NewQueryMask(sp selectPart, fp fromPart, wp wherePart, gp groupByPart, hp havingPart) QueryMask
func (*QueryMask) ApplyFilter ¶
ApplyFilter returns true if m passes the filter f. Note: only certain query parts are included; namely, the orderBy and limit masks are not applied to the filter.
func (*QueryMask) HasGroupBy ¶
HasGroupBy returns true if the mask contains a supported group by clause.
func (*QueryMask) HasHaving ¶
HasHaving returns true if the mask contains a supported having clause.
func (*QueryMask) HasOrderBy ¶
HasOrderBy returns true if the mask contains a supported order by clause.
func (*QueryMask) HasSelect ¶
HasSelect returns true if the mask contains a supported select clause.
func (*QueryMask) HasSelectPart ¶
HasSelectPart returns true if the mask contains the provided select part.
type SelectHandler ¶
type SelectHandler struct {
// contains filtered or unexported fields
}
SelectHandler executes SQL select statements
func NewSelectHandler ¶
func NewSelectHandler(api *pilosa.API) *SelectHandler
NewSelectHandler constructor
func (*SelectHandler) MapSelect ¶
func (s *SelectHandler) MapSelect(ctx context.Context, selectStmt *sqlparser.Select, qm QueryMask) (*MappingResult, error)
type SelectProperties ¶
type ShowHandler ¶
type ShowHandler struct {
// contains filtered or unexported fields
}
ShowHandler executes SQL show table/field statements
type StarColumn ¶
type StarColumn struct{}
func NewStarColumn ¶
func NewStarColumn() *StarColumn
func (*StarColumn) Alias ¶
func (s *StarColumn) Alias() string
func (*StarColumn) Name ¶
func (s *StarColumn) Name() string
func (*StarColumn) Source ¶
func (s *StarColumn) Source() string