types

package
v3.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2025 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrecedenceGenerated = iota // 0 - highest precedence

	PrecedenceParsed   // 1
	PrecedenceMetadata // 2
	PrecedenceLabel    // 3
	PrecedenceBuiltin  // 4 - lowest precedence
)

Column type precedence for ambiguous column resolution (highest to lowest): Generated > Parsed > Metadata > Label > Builtin

View Source
const (
	ColumnNameBuiltinTimestamp = "timestamp"
	ColumnNameBuiltinMessage   = "message"
	ColumnNameGeneratedValue   = "value"

	MetadataKeyColumnType     = "column_type"
	MetadataKeyColumnDataType = "column_datatype"
)

Names of the builtin columns.

View Source
const (
	ColumnNameError        = "__error__"
	ColumnNameErrorDetails = "__error_details__"
)

Names of error columns

View Source
const (
	LogfmtParserErrorType     = "LogfmtParserErr"
	JSONParserErrorType       = "JSONParserErr"
	SampleExtractionErrorType = "SampleExtractionErr"
)

Error types.

View Source
const (
	NULL      = Type(arrow.NULL)
	BOOL      = Type(arrow.BOOL)
	STRING    = Type(arrow.STRING)
	INT64     = Type(arrow.INT64)
	FLOAT64   = Type(arrow.FLOAT64)
	TIMESTAMP = Type(arrow.TIMESTAMP)
	STRUCT    = Type(arrow.STRUCT)
)

Variables

View Source
var (
	Loki = struct {
		Null      DataType
		Bool      DataType
		String    DataType
		Integer   DataType
		Float     DataType
		Timestamp DataType
		Duration  DataType
		Bytes     DataType
		Struct    DataType
	}{
		Null:      tNull{},
		Bool:      tBool{},
		String:    tString{},
		Integer:   tInteger{},
		Float:     tFloat{},
		Timestamp: tTimestamp{},
		Duration:  tDuration{},
		Bytes:     tBytes{},
		Struct:    tStruct{},
	}

	Arrow = struct {
		Null      arrow.DataType
		Bool      arrow.DataType
		String    arrow.DataType
		Integer   arrow.DataType
		Float     arrow.DataType
		Timestamp arrow.DataType
		Duration  arrow.DataType
		Bytes     arrow.DataType
	}{
		Null:      arrow.Null,
		Bool:      arrow.FixedWidthTypes.Boolean,
		String:    arrow.BinaryTypes.String,
		Integer:   arrow.PrimitiveTypes.Int64,
		Float:     arrow.PrimitiveTypes.Float64,
		Timestamp: arrow.FixedWidthTypes.Timestamp_ns,
		Duration:  arrow.PrimitiveTypes.Int64,
		Bytes:     arrow.PrimitiveTypes.Int64,
	}
)

Functions

func ColumnTypePrecedence added in v3.6.0

func ColumnTypePrecedence(ct ColumnType) int

ColumnTypePrecedence returns the precedence of the given ColumnType.

Types

type BinaryOp

type BinaryOp uint32

BinaryOp denotes the kind of BinaryOp operation to perform.

const (
	// BinaryOpInvalid indicates an invalid binary operation.
	BinaryOpInvalid BinaryOp = iota

	BinaryOpEq  // Equality comparison (==).
	BinaryOpNeq // Inequality comparison (!=).
	BinaryOpGt  // Greater than comparison (>).
	BinaryOpGte // Greater than or equal comparison (>=).
	BinaryOpLt  // Less than comparison (<).
	BinaryOpLte // Less than or equal comparison (<=).

	BinaryOpAnd // Logical AND operation (&&).
	BinaryOpOr  // Logical OR operation (||).
	BinaryOpXor // Logical XOR operation (^).
	BinaryOpNot // Logical NOT operation (!).

	BinaryOpAdd // Addition operation (+).
	BinaryOpSub // Subtraction operation (-).
	BinaryOpMul // Multiplication operation (*).
	BinaryOpDiv // Division operation (/).
	BinaryOpMod // Modulo operation (%).

	BinaryOpMatchSubstr     // Substring matching operation (|=). Used for string match filter.
	BinaryOpNotMatchSubstr  // Substring non-matching operation (!=). Used for string match filter.
	BinaryOpMatchRe         // Regular expression matching operation (|~). Used for regex match filter and label matcher.
	BinaryOpNotMatchRe      // Regular expression non-matching operation (!~). Used for regex match filter and label matcher.
	BinaryOpMatchPattern    // Pattern matching operation (|>). Used for pattern match filter.
	BinaryOpNotMatchPattern // Pattern non-matching operation (!>). Use for pattern match filter.
)

Recognized values of BinaryOp.

func (BinaryOp) String

func (t BinaryOp) String() string

String returns a human-readable representation of the binary operation kind.

type BoolLiteral added in v3.6.0

type BoolLiteral bool

func (BoolLiteral) Any added in v3.6.0

func (b BoolLiteral) Any() any

Any implements Literal.

func (BoolLiteral) String added in v3.6.0

func (b BoolLiteral) String() string

String implements Literal.

func (BoolLiteral) Type added in v3.6.0

func (b BoolLiteral) Type() DataType

Type implements Literal.

func (BoolLiteral) Value added in v3.6.0

func (b BoolLiteral) Value() bool

type Bytes added in v3.6.0

type Bytes int64

type BytesLiteral added in v3.6.0

type BytesLiteral Bytes

func (BytesLiteral) Any added in v3.6.0

func (b BytesLiteral) Any() any

Any implements Literal.

func (BytesLiteral) String added in v3.6.0

func (b BytesLiteral) String() string

String implements Literal.

func (BytesLiteral) Type added in v3.6.0

func (b BytesLiteral) Type() DataType

Type implements Literal.

func (BytesLiteral) Value added in v3.6.0

func (b BytesLiteral) Value() Bytes

type ColumnRef added in v3.6.0

type ColumnRef struct {
	Column string     // Name of the column being referenced.
	Type   ColumnType // Type of the column being referenced.
}

A ColumnRef referenes a column within a table relation.

func (*ColumnRef) String added in v3.6.0

func (c *ColumnRef) String() string

Name returns the identifier of the ColumnRef, which combines the column type and column name being referenced.

type ColumnType

type ColumnType int

ColumnType denotes the column type for a ColumnRef.

const (
	// ColumnTypeInvalid indicates an invalid column type.
	ColumnTypeInvalid ColumnType = iota

	ColumnTypeBuiltin   // ColumnTypeBuiltin represents a builtin column (such as timestamp).
	ColumnTypeLabel     // ColumnTypeLabel represents a column from a stream label.
	ColumnTypeMetadata  // ColumnTypeMetadata represents a column from a log metadata.
	ColumnTypeParsed    // ColumnTypeParsed represents a parsed column from a parser stage.
	ColumnTypeAmbiguous // ColumnTypeAmbiguous represents a column that can either be a builtin, label, metadata, or parsed.
	ColumnTypeGenerated // ColumnTypeGenerated represents a column that is generated from an expression or computation.
)

Recognized values of ColumnType.

func ColumnTypeFromString added in v3.6.0

func ColumnTypeFromString(ct string) ColumnType

ColumnTypeFromString returns the ColumnType from its string representation.

func (ColumnType) String

func (ct ColumnType) String() string

String returns a human-readable representation of the column type.

type DataType added in v3.6.0

type DataType interface {
	fmt.Stringer
	ID() Type
	ArrowType() arrow.DataType
}

func FromString added in v3.6.0

func FromString(dt string) (DataType, error)

func MustFromString added in v3.6.0

func MustFromString(dt string) DataType

func NewStructType added in v3.6.0

func NewStructType(arrowType *arrow.StructType) DataType

NewStructType creates a DataType from an Arrow StructType

type Duration added in v3.6.0

type Duration int64

type DurationLiteral added in v3.6.0

type DurationLiteral int64

func (DurationLiteral) Any added in v3.6.0

func (d DurationLiteral) Any() any

Any implements Literal.

func (DurationLiteral) String added in v3.6.0

func (d DurationLiteral) String() string

String implements Literal.

func (DurationLiteral) Type added in v3.6.0

func (d DurationLiteral) Type() DataType

Type implements Literal.

func (DurationLiteral) Value added in v3.6.0

func (d DurationLiteral) Value() Duration

type FloatLiteral added in v3.6.0

type FloatLiteral float64

func (FloatLiteral) Any added in v3.6.0

func (f FloatLiteral) Any() any

Any implements Literal.

func (FloatLiteral) String added in v3.6.0

func (f FloatLiteral) String() string

String implements Literal.

func (FloatLiteral) Type added in v3.6.0

func (f FloatLiteral) Type() DataType

Type implements Literal.

func (FloatLiteral) Value added in v3.6.0

func (f FloatLiteral) Value() float64

type IntegerLiteral added in v3.6.0

type IntegerLiteral int64

func (IntegerLiteral) Any added in v3.6.0

func (i IntegerLiteral) Any() any

Any implements Literal.

func (IntegerLiteral) String added in v3.6.0

func (i IntegerLiteral) String() string

String implements Literal.

func (IntegerLiteral) Type added in v3.6.0

func (i IntegerLiteral) Type() DataType

Type implements Literal.

func (IntegerLiteral) Value added in v3.6.0

func (i IntegerLiteral) Value() int64

type Literal added in v3.6.0

type Literal interface {
	fmt.Stringer
	Any() any
	Type() DataType
}

Literal is holds a value of [any] typed as DataType.

func NewLiteral added in v3.6.0

func NewLiteral[T LiteralType](value T) Literal

type LiteralType added in v3.6.0

type LiteralType interface {
	any | bool | string | int64 | float64 | Timestamp | Duration | Bytes
}

type NullLiteral added in v3.6.0

type NullLiteral struct {
}

func NewNullLiteral added in v3.6.0

func NewNullLiteral() NullLiteral

func (NullLiteral) Any added in v3.6.0

func (n NullLiteral) Any() any

Any implements Literal.

func (NullLiteral) String added in v3.6.0

func (n NullLiteral) String() string

String implements Literal.

func (NullLiteral) Type added in v3.6.0

func (n NullLiteral) Type() DataType

Type implements Literal.

func (NullLiteral) Value added in v3.6.0

func (n NullLiteral) Value() any

type RangeAggregationType added in v3.6.0

type RangeAggregationType int

RangeAggregationType represents the type of range aggregation operation

const (
	RangeAggregationTypeInvalid RangeAggregationType = iota

	RangeAggregationTypeCount // Represents count_over_time range aggregation
	RangeAggregationTypeSum   // Represents sum_over_time range aggregation
	RangeAggregationTypeMax   // Represents max_over_time range aggregation
	RangeAggregationTypeMin   // Represents min_over_time range aggregation
)

func (RangeAggregationType) String added in v3.6.0

func (op RangeAggregationType) String() string

type StringLiteral added in v3.6.0

type StringLiteral string

func (StringLiteral) Any added in v3.6.0

func (s StringLiteral) Any() any

Any implements Literal.

func (StringLiteral) String added in v3.6.0

func (s StringLiteral) String() string

String implements Literal.

func (StringLiteral) Type added in v3.6.0

func (s StringLiteral) Type() DataType

Type implements Literal.

func (StringLiteral) Value added in v3.6.0

func (s StringLiteral) Value() string

type Timestamp added in v3.6.0

type Timestamp int64

type TimestampLiteral added in v3.6.0

type TimestampLiteral Timestamp

func (TimestampLiteral) Any added in v3.6.0

func (t TimestampLiteral) Any() any

Any implements Literal.

func (TimestampLiteral) String added in v3.6.0

func (t TimestampLiteral) String() string

String implements Literal.

func (TimestampLiteral) Type added in v3.6.0

func (t TimestampLiteral) Type() DataType

Type implements Literal.

func (TimestampLiteral) Value added in v3.6.0

func (t TimestampLiteral) Value() Timestamp

type Type added in v3.6.0

type Type uint8

func (Type) String added in v3.6.0

func (t Type) String() string

type TypedLiteral added in v3.6.0

type TypedLiteral[T LiteralType] interface {
	Literal
	Value() T
}

type UnaryOp

type UnaryOp uint32

UnaryOp denotes the kind of UnaryOp operation to perform.

const (
	// UnaryOpKindInvalid indicates an invalid unary operation.
	UnaryOpInvalid UnaryOp = iota

	UnaryOpNot          // Logical NOT operation (!).
	UnaryOpAbs          // Mathematical absolute operation (abs).
	UnaryOpCastFloat    // Cast string to float value operation (unwrap).
	UnaryOpCastBytes    // Cast string bytes to float value operation (unwrap).
	UnaryOpCastDuration // Cast string duration to float value operation (unwrap).
)

Recognized values of UnaryOp.

func (UnaryOp) String

func (t UnaryOp) String() string

String returns the string representation of the UnaryOp.

type VectorAggregationType added in v3.6.0

type VectorAggregationType int

VectorAggregationType represents the type of vector aggregation operation

const (
	VectorAggregationTypeInvalid VectorAggregationType = iota

	VectorAggregationTypeSum      // Represents sum vector aggregation
	VectorAggregationTypeMax      // Represents max vector aggregation
	VectorAggregationTypeMin      // Represents min vector aggregation
	VectorAggregationTypeCount    // Represents count vector aggregation
	VectorAggregationTypeAvg      // Represents avg vector aggregation
	VectorAggregationTypeStddev   // Represents stddev vector aggregation
	VectorAggregationTypeStdvar   // Represents stdvar vector aggregation
	VectorAggregationTypeBottomK  // Represents bottomk vector aggregation
	VectorAggregationTypeTopK     // Represents topk vector aggregation
	VectorAggregationTypeSort     // Represents sort vector aggregation
	VectorAggregationTypeSortDesc // Represents sort_desc vector aggregation
)

func (VectorAggregationType) String added in v3.6.0

func (op VectorAggregationType) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL