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 ¶
- func FilterOpenSearch(body string, filters []query.ColumnFilterValue) (string, error)
- func FilterSQL(driver, statement string, filters []query.ColumnFilterValue) (string, []any, error)
- func NeedsOpenSearchTimeFieldMapping(params []esdsl.ParamBinding) bool
- func ResolveOpenSearchTimeFieldMapping(ctx dbcontext.Context, request OpenSearchTimeFieldMappingRequest) (*esdsl.TimeFieldMapping, error)
- type OpenSearchTimeFieldMappingRequest
- type SQLPageRequest
- type SQLPageResult
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 FilterSQL ¶
FilterSQL wraps an operator-authored statement so the given selections narrow its result rather than its text, for a caller that runs its own SQL rather than a stored profile — the connection browser.
It exists so there is one CTE wrapper and one predicate builder in the codebase: a second implementation would be a second set of quoting and binding rules to keep correct, and the two would disagree on the day one of them was fixed.
driver is the connection type (models.ConnectionType*), not a registry key.
func NeedsOpenSearchTimeFieldMapping ¶
func NeedsOpenSearchTimeFieldMapping(params []esdsl.ParamBinding) bool
NeedsOpenSearchTimeFieldMapping reports whether resolved parameters contain a non-empty time bound.
func ResolveOpenSearchTimeFieldMapping ¶
func ResolveOpenSearchTimeFieldMapping(ctx dbcontext.Context, request OpenSearchTimeFieldMappingRequest) (*esdsl.TimeFieldMapping, error)
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 SQLPageRequest ¶
type SQLPageRequest struct {
Query string
QueryArgs []any
QueryIdentifiers []string
Filters []query.ColumnFilterValue
Order query.Order
Position query.CursorPosition
Page query.PageRequest
Diagnostics *query.ProviderDiagnostics
}
type SQLPageResult ¶
type SQLPageResult struct {
Rows []query.Row
ColumnTypes []*sql.ColumnType
Total *query.Total
HasMore bool
}
func ReadSQLPage ¶
func ReadSQLPage(ctx context.Context, client *sql.DB, driver string, request SQLPageRequest) (result SQLPageResult, err error)
Source Files
¶
- aws.go
- azurelogs.go
- bigquery.go
- cloudwatch.go
- column_inspection.go
- gcp.go
- gcplogging.go
- http.go
- inline_url.go
- jaeger.go
- k8s_diagnostics.go
- k8s_lookup.go
- k8s_target.go
- k8slogs.go
- loki.go
- opensearch.go
- opensearch_column_inspection.go
- opensearch_filter.go
- opensearch_lookup.go
- opensearch_order.go
- opensearch_search.go
- opensearch_tail.go
- opensearch_time.go
- opensearch_walk.go
- opentelemetry.go
- opentelemetry_parser.go
- opentelemetry_search.go
- postgrest.go
- prometheus.go
- sql.go
- sql_diagnostics.go
- sql_dialect.go
- sql_filter.go
- sql_lex.go
- sql_lookup.go
- sql_page.go
- sql_params.go