Documentation
¶
Index ¶
- Constants
- Variables
- func FQN(name string, ct types.ColumnType, dt types.DataType) string
- func FieldFromFQN(fqn string, nullable bool) arrow.Field
- func FieldFromIdent(ident *Identifier, nullable bool) arrow.Field
- type Identifier
- func (i *Identifier) ColumnType() types.ColumnType
- func (i *Identifier) DataType() types.DataType
- func (i *Identifier) Equal(other *Identifier) bool
- func (i *Identifier) FQN() string
- func (i *Identifier) SemName() string
- func (i *Identifier) SemType() SemanticType
- func (i *Identifier) ShortName() string
- func (i *Identifier) String() string
- type SemanticType
Constants ¶
const ( Resource = semOrigin("resource") Record = semOrigin("record") Generated = semOrigin("generated") Unscoped = semOrigin("unscoped") Attribute = semType("attr") Builtin = semType("builtin") InvalidOrigin = semOrigin("") InvalidType = semType("") )
Variables ¶
var ( ColumnIdentMessage = NewIdentifier("message", types.ColumnTypeBuiltin, types.Loki.String) ColumnIdentTimestamp = NewIdentifier("timestamp", types.ColumnTypeBuiltin, types.Loki.Timestamp) ColumnIdentValue = NewIdentifier("value", types.ColumnTypeGenerated, types.Loki.Float) ColumnIdentError = NewIdentifier("__error__", types.ColumnTypeGenerated, types.Loki.String) ColumnIdentErrorDetails = NewIdentifier("__error_details__", types.ColumnTypeGenerated, types.Loki.String) )
Functions ¶
func FQN ¶
FQN returns a fully qualified name for a column by given name, column type, and data type.
func FieldFromIdent ¶
func FieldFromIdent(ident *Identifier, nullable bool) arrow.Field
Types ¶
type Identifier ¶
type Identifier struct {
// contains filtered or unexported fields
}
Identifier is the unique identifier of a column. The uniqueness of a column is defined by its data type, column type (scope), and name. The fully qualified name is represented as [DATA_TYPE].[COLUMN_TYPE].[COLUMN_NAME].
func MustParseFQN ¶
func MustParseFQN(fqn string) *Identifier
ParseFQN returns an Identifier from the given fully qualified name. It panics if the name cannot be parsed.
func NewIdentifier ¶
func NewIdentifier(name string, ct types.ColumnType, dt types.DataType) *Identifier
NewIdentifier creates a new column identifier from given name, column type, and data type. The semantic type of an identifier is derived from its column type.
func ParseFQN ¶
func ParseFQN(fqn string) (*Identifier, error)
ParseFQN returns an Identifier from the given fully qualified name. It returns an error if the name cannot be parsed.
func (*Identifier) ColumnType ¶
func (i *Identifier) ColumnType() types.ColumnType
ColumnType returns the column type of the identifier.
func (*Identifier) DataType ¶
func (i *Identifier) DataType() types.DataType
DataType returns the Loki data type of the identifier.
func (*Identifier) Equal ¶
func (i *Identifier) Equal(other *Identifier) bool
Equal checks equality of of the identifier against a second identifier.
func (*Identifier) FQN ¶
func (i *Identifier) FQN() string
FQN returns the fully qualified name of the identifier.
func (*Identifier) SemName ¶
func (i *Identifier) SemName() string
SemName returns the semantic name of the column identifier, defined as [ORIGIN].[NAME] in case of attributes [ORIGIN]:[NAME] in case of builtins
func (*Identifier) SemType ¶
func (i *Identifier) SemType() SemanticType
SemType returns the semantic type of the identifier.
func (*Identifier) ShortName ¶
func (i *Identifier) ShortName() string
ShortName returns the non-unique name part of the column identifier.
func (*Identifier) String ¶
func (i *Identifier) String() string
String returns the string representation of the column. This must not be used as name for arrow.Field.
type SemanticType ¶
type SemanticType struct {
Origin semOrigin
Type semType
}
SemanticType describes the origin and type of an identifier.
func SemTypeForColumnType ¶
func SemTypeForColumnType(value types.ColumnType) SemanticType
SemTypeForColumnType converts a given types.ColumnType into a SemanticType.
func (SemanticType) String ¶
func (s SemanticType) String() string