Help us shape the future of Go! Take the 2026 Go Developer Survey

semconv

package
v3.7.9 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Resource  = semOrigin("resource")
	Record    = semOrigin("record")
	Generated = semOrigin("generated")
	Unscoped  = semOrigin("unscoped")

	Attribute = semType("attr")
	Builtin   = semType("builtin")

	InvalidOrigin = semOrigin("")
	InvalidType   = semType("")
)

Variables

View Source
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

func FQN(name string, ct types.ColumnType, dt types.DataType) string

FQN returns a fully qualified name for a column by given name, column type, and data type.

func FieldFromFQN

func FieldFromFQN(fqn string, nullable bool) arrow.Field

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) ColumnRef added in v3.7.0

func (i *Identifier) ColumnRef() types.ColumnRef

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 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 IdentifierCache added in v3.7.0

type IdentifierCache struct {
	// contains filtered or unexported fields
}

IdentifierCache caches Identifier objects for a given FQN string to reduce memory allocations. IdentifierCache is not thread-safe.

func NewIdentifierCache added in v3.7.0

func NewIdentifierCache() *IdentifierCache

func (*IdentifierCache) ParseFQN added in v3.7.0

func (c *IdentifierCache) ParseFQN(fqn string) (*Identifier, error)

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

Jump to

Keyboard shortcuts

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