providers

package
v0.1.60 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 51 Imported by: 5

Documentation

Overview

Package providers contains the built-in data providers for the query engine. Each provider self-registers via init(); consumers enable them with a blank import:

import _ "github.com/flanksource/commons-db/query/providers"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterOpenSearch

func FilterOpenSearch(body string, filters []query.ColumnFilterValue) (string, error)

FilterOpenSearch folds the given selections into an already-rendered query body, for a caller that assembled its own DSL rather than a stored profile — the connection browser.

It exists so there is one clause compiler in the codebase: a second implementation would be a second set of rules for what excluding a value means, and the two would disagree on the day one of them was fixed.

With no active filter it returns the body byte for byte, so turning filtering on cannot change what an unfiltered query sends.

func NeedsOpenSearchTimeFieldMapping

func NeedsOpenSearchTimeFieldMapping(params []esdsl.ParamBinding) bool

NeedsOpenSearchTimeFieldMapping reports whether resolved parameters contain a non-empty time bound.

func ReadOpenTelemetrySpans added in v0.1.49

func ReadOpenTelemetrySpans(ctx context.Context, read OpenTelemetryRead, emit func(query.Row)) error

ReadOpenTelemetrySpans emits each span read, normalized as the opentelemetry provider's rows are, with source_index and source_id naming its document. It reads in the date field's order with search_after, opening no point in time, so a follow sees what lands after it started.

Types

type OpenSearchTimeFieldMappingRequest

type OpenSearchTimeFieldMappingRequest struct {
	Searcher   *opensearch.Searcher
	Index      string
	Search     esdsl.Search
	Params     []esdsl.ParamBinding
	Inspection query.InspectionOptions
}

ResolveOpenSearchTimeFieldMapping reads the exact field used by active time-role parameters. The mapping is runtime metadata and never becomes part of the stored profile.

type OpenTelemetryRead added in v0.1.49

type OpenTelemetryRead struct {
	// Connection is the opentelemetry connection, and Options the
	// opentelemetry provider's options for its index and fields.
	Connection string
	Options    map[string]any
	// From and To bound the read on the date field, as date math such as
	// now-1h or RFC3339; empty leaves that side open.
	From, To string
	// Follow keeps reading the spans indexed after the read caught up, until
	// ctx ends; it has no To.
	Follow bool
	// Poll is how long a caught-up follow waits before asking again; zero is
	// two seconds. Lag holds a follow behind now, so spans indexed late still
	// land before the read passes their instant.
	Poll, Lag time.Duration
}

OpenTelemetryRead is one read of span documents.

Directories

Path Synopsis
internal
providerkit
Package providerkit holds the helpers shared by the query provider packages, so a provider split into its own package (sqlite) and the bundle (query/providers) use one implementation without importing each other.
Package providerkit holds the helpers shared by the query provider packages, so a provider split into its own package (sqlite) and the bundle (query/providers) use one implementation without importing each other.
Package sqlite holds the dialect-generic SQL query provider and registers it under the "sqlite" key.
Package sqlite holds the dialect-generic SQL query provider and registers it under the "sqlite" key.

Jump to

Keyboard shortcuts

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