Documentation
¶
Index ¶
- Constants
- func CheckEpochOutOfRange(epoch, min, max time.Time) error
- func IsValidTimeUnit(unit string) bool
- func TimeUnitNanos(unit string) int64
- func TimestampToVal(unit string, ts time.Time) int64
- func ValToTimestamp(unit string, val int64) (time.Time, error)
- type BaseType
- type DistinctTimestamp
- type ExtractedIDColumn
- type ExtractedIDMatrix
- type ExtractedTable
- type ExtractedTableColumn
- type ExtractedTableField
- type Field
- type FieldName
- type FieldOptions
- type FieldRow
- type GroupCount
- type GroupCounts
- type KeyOrID
- type RowIdentifiers
- type SignedRow
- type StringTableKeyer
- type Table
- type TableID
- type TableKey
- type TableKeyer
- type TableName
- type ValCount
- func (vc *ValCount) Add(other ValCount) ValCount
- func (v *ValCount) Clone() (r *ValCount)
- func (vc *ValCount) Larger(other ValCount) ValCount
- func (vc *ValCount) Smaller(other ValCount) ValCount
- func (v ValCount) ToRows(callback func(*proto.RowResponse) error) error
- func (v ValCount) ToTable() (*proto.TableResponse, error)
Constants ¶
const ( BaseTypeBool = "bool" // BaseTypeDecimal = "decimal" // BaseTypeID = "id" // non-keyed mutex BaseTypeIDSet = "idset" // non-keyed set BaseTypeIDSetQ = "idsetq" // non-keyed set timequantum BaseTypeInt = "int" // BaseTypeString = "string" // keyed mutex BaseTypeStringSet = "stringset" // keyed set BaseTypeStringSetQ = "stringsetq" // keyed set timequantum BaseTypeTimestamp = "timestamp" // PrimaryKeyFieldName = FieldName("_id") )
const ( TimeUnitSeconds = "s" TimeUnitMilliseconds = "ms" TimeUnitMicroseconds = "µs" TimeUnitUSeconds = "us" TimeUnitNanoseconds = "ns" )
Constants related to timestamp.
Variables ¶
This section is empty.
Functions ¶
func CheckEpochOutOfRange ¶
CheckEpochOutOfRange checks if the epoch is after max or before min
func IsValidTimeUnit ¶
IsValidTimeUnit returns true if unit is valid.
func TimeUnitNanos ¶
TimeUnitNanos returns the number of nanoseconds in unit.
func TimestampToVal ¶
TimestampToVal takes a time unit and a time.Time and converts it to an integer value
Types ¶
type DistinctTimestamp ¶
func (DistinctTimestamp) ToRows ¶
func (d DistinctTimestamp) ToRows(callback func(*proto.RowResponse) error) error
ToRows implements the ToRowser interface.
func (DistinctTimestamp) ToTable ¶
func (d DistinctTimestamp) ToTable() (*proto.TableResponse, error)
ToTable implements the ToTabler interface for DistinctTimestamp
func (*DistinctTimestamp) Union ¶
func (d *DistinctTimestamp) Union(other DistinctTimestamp) DistinctTimestamp
Union returns the union of the values of `d` and `other`
type ExtractedIDColumn ¶
type ExtractedIDMatrix ¶
type ExtractedIDMatrix struct { Fields []string Columns []ExtractedIDColumn }
func (*ExtractedIDMatrix) Append ¶
func (e *ExtractedIDMatrix) Append(m ExtractedIDMatrix)
type ExtractedTable ¶
type ExtractedTable struct { Fields []ExtractedTableField `json:"fields"` Columns []ExtractedTableColumn `json:"columns"` }
func (ExtractedTable) ToRows ¶
func (t ExtractedTable) ToRows(callback func(*proto.RowResponse) error) error
ToRows implements the ToRowser interface.
func (ExtractedTable) ToTable ¶
func (t ExtractedTable) ToTable() (*proto.TableResponse, error)
ToTable converts the table to protobuf format.
type ExtractedTableColumn ¶
type ExtractedTableColumn struct { Column KeyOrID `json:"column"` Rows []interface{} `json:"rows"` }
type ExtractedTableField ¶
type Field ¶
type Field struct { Name FieldName `json:"name"` Type BaseType `json:"type"` Options FieldOptions `json:"options"` }
Field represents a field and its configuration.
func (*Field) IsPrimaryKey ¶
IsPrimaryKey returns true if the field is the primary key field (of either type ID or STRING).
type FieldOptions ¶
type FieldOptions struct { Min pql.Decimal `json:"min,omitempty"` Max pql.Decimal `json:"max,omitempty"` Scale int64 `json:"scale,omitempty"` NoStandardView bool `json:"no-standard-view,omitempty"` // TODO: we should remove this CacheType string `json:"cache-type,omitempty"` CacheSize uint32 `json:"cache-size,omitempty"` TimeUnit string `json:"time-unit,omitempty"` Epoch time.Time `json:"epoch,omitempty"` TimeQuantum quantum.TimeQuantum `json:"time-quantum,omitempty"` TTL time.Duration `json:"ttl,omitempty"` ForeignIndex string `json:"foreign-index,omitempty"` TrackExistence bool `json:"track-existence"` }
FieldOptions represents options to set when initializing a field.
type FieldRow ¶
type FieldRow struct { Field Field `json:"field"` RowID uint64 `json:"rowID"` RowKey string `json:"rowKey,omitempty"` Value *int64 `json:"value,omitempty"` }
FieldRow is used to distinguish rows in a group by result.
func (FieldRow) MarshalJSON ¶
MarshalJSON marshals FieldRow to JSON such that either a Key or an ID is included.
type GroupCount ¶
type GroupCount struct { Group []FieldRow `json:"group"` Count uint64 `json:"count"` Agg int64 `json:"-"` DecimalAgg *pql.Decimal `json:"-"` }
GroupCount represents a result item for a group by query.
func ApplyConditionToGroupCounts ¶
func ApplyConditionToGroupCounts(gcs []GroupCount, subj string, cond *pql.Condition) []GroupCount
ApplyConditionToGroupCounts filters the contents of gcs according to the condition. Currently, `count` and `sum` are the only fields supported.
func (*GroupCount) Clone ¶
func (g *GroupCount) Clone() (r *GroupCount)
func (GroupCount) Compare ¶
func (g GroupCount) Compare(o GroupCount) int
Compare is used in ordering two GroupCount objects.
type GroupCounts ¶
type GroupCounts struct {
// contains filtered or unexported fields
}
GroupCounts is a list of GroupCount.
func NewGroupCounts ¶
func NewGroupCounts(agg string, groups ...GroupCount) *GroupCounts
NewGroupCounts creates a GroupCounts with the given type and slice of GroupCount objects. There's intentionally no externally-accessible way to change the []GroupCount after creation.
func (*GroupCounts) AggregateColumn ¶
func (g *GroupCounts) AggregateColumn() string
AggregateColumn gives the likely column name to use for aggregates, because for historical reasons we used "sum" when it was a sum, but don't want to use that when it's something else. This will likely get revisited.
func (*GroupCounts) Groups ¶
func (g *GroupCounts) Groups() []GroupCount
Groups is a convenience method to let us not worry as much about the potentially-nil nature of a *GroupCounts.
func (*GroupCounts) MarshalJSON ¶
func (g *GroupCounts) MarshalJSON() ([]byte, error)
MarshalJSON makes GroupCounts satisfy interface json.Marshaler and customizes the JSON output of the aggregate field label.
func (*GroupCounts) ToRows ¶
func (g *GroupCounts) ToRows(callback func(*proto.RowResponse) error) error
ToRows implements the ToRowser interface.
func (*GroupCounts) ToTable ¶
func (g *GroupCounts) ToTable() (*proto.TableResponse, error)
ToTable implements the ToTabler interface.
type KeyOrID ¶
func (KeyOrID) MarshalJSON ¶
type RowIdentifiers ¶
type RowIdentifiers struct { Rows []uint64 `json:"rows"` Keys []string `json:"keys,omitempty"` Field string }
RowIdentifiers is a return type for a list of row ids or row keys. The names `Rows` and `Keys` are meant to follow the same convention as the Row query which returns `Columns` and `Keys`. TODO: Rename this to something better. Anything.
func (*RowIdentifiers) Clone ¶
func (r *RowIdentifiers) Clone() (clone *RowIdentifiers)
func (RowIdentifiers) ToRows ¶
func (r RowIdentifiers) ToRows(callback func(*proto.RowResponse) error) error
ToRows implements the ToRowser interface.
func (RowIdentifiers) ToTable ¶
func (r RowIdentifiers) ToTable() (*proto.TableResponse, error)
ToTable implements the ToTabler interface.
type SignedRow ¶
type SignedRow struct { Neg *rows.Row `json:"neg"` Pos *rows.Row `json:"pos"` Field string `json:"-"` }
SignedRow represents a signed *Row with two (neg/pos) *Rows.
func (SignedRow) ToRows ¶
func (s SignedRow) ToRows(callback func(*proto.RowResponse) error) error
ToRows implements the ToRowser interface.
type StringTableKeyer ¶
type StringTableKeyer string
StringTableKeyer is a helper type which can wrap a string, making it a TableKeyer. This is useful for certain calls to Execute() which take a string index name.
func (StringTableKeyer) Key ¶
func (s StringTableKeyer) Key() TableKey
type Table ¶
type Table struct { ID TableID `json:"id,omitempty"` Name TableName `json:"name,omitempty"` Fields []*Field `json:"fields"` PartitionN int `json:"partitionN"` Description string `json:"description,omitempty"` Owner string `json:"owner,omitempty"` UpdatedBy string `json:"updatedBy,omitempty"` }
Table represents a table and its configuration.
func (*Table) Field ¶
Field returns the field with the provided name. If a field with that name does not exist, the returned boolean will be false.
func (*Table) FieldNames ¶
FieldNames returns the list of field names associated with the table.
func (*Table) HasValidPrimaryKey ¶
HasValidPrimaryKey returns false if the table does not contain a primary key field (which is required), or if the primary key field is not a valid type.
func (*Table) StringKeys ¶
StringKeys returns true if the table's primary key is either a string or a concatenation of fields.
type TableKey ¶
type TableKey string
TableKey is a globally unique identifier for a table; it is effectively the compound key: (org, database, table). This is (hopefully) the value that will be used when interfacing with services which are unaware of table qualifiers. For example, the FeatureBase server has no notion of organization or database; its top level type is index/indexName/table. So in this case, until and unless we introduce table qualifiers into FeatureBase, we will use TableKey as the value for index.Name.
type TableKeyer ¶
type TableKeyer interface {
Key() TableKey
}
TableKeyer is an interface implemented by any type which can produce, and be represented by, a TableKey. In the case of a QualifiedTable, its TableKey might be something like `tbl__org__db__tableid`, while a general pilosa implemenation might represent a table as a basic table name `foo`.
type ValCount ¶
type ValCount struct { Val int64 `json:"value"` FloatVal float64 `json:"floatValue"` DecimalVal *pql.Decimal `json:"decimalValue"` TimestampVal time.Time `json:"timestampValue"` Count int64 `json:"count"` }
ValCount represents a grouping of sum & count for Sum() and Average() calls. Also Min, Max....