Documentation
¶
Index ¶
- func AggregationTypeFromSub(subAggTypeName string) string
- func Build() error
- func IsKnownJSONType(typeName string) bool
- func IsScalar(name string) bool
- func IsSubAggregationType(typeName string) bool
- func JSONTypeHint(typeName string) string
- func JSONTypeHintWithOk(typeName string) (string, bool)
- func ParseArray(typeName string, v any) (any, error)
- func ParseValue(typeName string, v any) (any, error)
- func Register(scalar ScalarType)
- func Scalars() iter.Seq[ScalarType]
- func Sources() []*ast.Source
- func SubAggregationTypeName(aggTypeName string) string
- type Aggregatable
- type ArrayParser
- type ExtraFieldProvider
- type FieldArgumentsProvider
- type Filterable
- type JSONTypeHintProvider
- type ListFilterable
- type MeasurementAggregatable
- type SQLOutputTransformer
- type ScalarType
- type SubAggregatable
- type ValueParser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AggregationTypeFromSub ¶
AggregationTypeFromSub returns the parent aggregation type name for a sub-aggregation type. E.g., "FloatSubAggregation" → "FloatAggregation". Returns "" if not found.
func Build ¶
func Build() error
Build validates that all registered scalars have non-empty names and SDL. Full SDL parsing validation happens at compile time when all sources are combined.
func IsKnownJSONType ¶
IsKnownJSONType returns true if the type name has a known JSON type mapping (scalar, aggregation, or sub-aggregation type).
func IsSubAggregationType ¶
IsSubAggregationType returns true if the type name is a scalar sub-aggregation type.
func JSONTypeHint ¶
JSONTypeHint returns the JSON extraction type hint for a type name. Checks scalars, their aggregation types, and their sub-aggregation types. Returns "" if not a known type or no hint available.
func JSONTypeHintWithOk ¶
JSONTypeHintWithOk returns the JSON extraction type hint and whether the type is known.
func ParseArray ¶
ParseArray dispatches array parsing to the scalar type's ArrayParser interface.
func ParseValue ¶
ParseValue dispatches value parsing to the scalar type's ValueParser interface.
func Register ¶
func Register(scalar ScalarType)
Register adds a scalar type to the global registry. If a scalar with the same name already exists, it is overwritten (last-write-wins).
func Scalars ¶
func Scalars() iter.Seq[ScalarType]
Scalars returns an iterator over all registered scalar types.
func SubAggregationTypeName ¶
SubAggregationTypeName returns the sub-aggregation type name for a given aggregation type. E.g., "FloatAggregation" → "FloatSubAggregation". Returns "" if not found.
Types ¶
type Aggregatable ¶
type Aggregatable interface {
AggregationTypeName() string
}
Aggregatable indicates the scalar supports aggregation.
type ArrayParser ¶
ArrayParser is implemented by scalar types that support array parsing.
type ExtraFieldProvider ¶
type ExtraFieldProvider interface {
ExtraFieldName() string
GenerateExtraField(fieldName string) *ast.FieldDefinition
}
ExtraFieldProvider indicates the scalar generates extra derived fields.
type FieldArgumentsProvider ¶
type FieldArgumentsProvider interface {
FieldArguments() ast.ArgumentDefinitionList
}
FieldArgumentsProvider indicates the scalar has field-level arguments (e.g., bucket for Timestamp, transforms for Geometry, struct for JSON).
type Filterable ¶
type Filterable interface {
FilterTypeName() string
}
Filterable indicates the scalar supports single-value filtering.
type JSONTypeHintProvider ¶
type JSONTypeHintProvider interface {
JSONTypeHint() string
}
JSONTypeHintProvider provides the JSON extraction type hint for engines. Hint examples: "string", "number", "bool", "timestamp".
type ListFilterable ¶
type ListFilterable interface {
ListFilterTypeName() string
}
ListFilterable indicates the scalar supports list-value filtering.
type MeasurementAggregatable ¶
type MeasurementAggregatable interface {
MeasurementAggregationTypeName() string
}
MeasurementAggregatable indicates the scalar supports measurement aggregation.
type SQLOutputTransformer ¶
type SQLOutputTransformer interface {
ToOutputSQL(sql string, raw bool) string
ToStructFieldSQL(sql string) string
}
SQLOutputTransformer is implemented by scalar types that need SQL output transformation (e.g., Geometry→ST_AsGeoJSON, H3Cell→h3_h3_to_string).
type ScalarType ¶
ScalarType represents a scalar's compilation-time metadata. Capabilities are determined via type assertions on optional interfaces (Filterable, ListFilterable, Aggregatable, MeasurementAggregatable, ExtraFieldProvider).
func Lookup ¶
func Lookup(name string) ScalarType
Lookup returns the scalar type with the given name, or nil if not found.
type SubAggregatable ¶
type SubAggregatable interface {
SubAggregationTypeName() string
}
SubAggregatable indicates the scalar has a sub-aggregation type for nested aggregations.
type ValueParser ¶
ValueParser is implemented by scalar types that need custom value parsing.
Source Files
¶
- extra_field_geometry.go
- extra_field_timestamp.go
- extra_field_vector.go
- init.go
- interfaces.go
- registry.go
- scalar_bigint.go
- scalar_bigintrange.go
- scalar_boolean.go
- scalar_date.go
- scalar_float.go
- scalar_geometry.go
- scalar_h3cell.go
- scalar_int.go
- scalar_interval.go
- scalar_intrange.go
- scalar_json.go
- scalar_string.go
- scalar_time.go
- scalar_timestamp.go
- scalar_timestamprange.go
- scalar_vector.go