providers

package
v0.1.31 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 55 Imported by: 0

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 FilterSQL

func FilterSQL(driver, statement string, filters []query.ColumnFilterValue) (string, []any, error)

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.

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)

Jump to

Keyboard shortcuts

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