Documentation
¶
Overview ¶
Package sqlite holds the dialect-generic SQL query provider and registers it under the "sqlite" key. A host that only needs SQLite-backed record stores enables it without the cloud providers:
import _ "github.com/flanksource/commons-db/query/providers/sqlite"
query/providers registers the remaining SQL keys (sql, postgres, mysql, sqlserver, clickhouse) through NewSQLProvider.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSQLProvider ¶
NewSQLProvider returns the SQL provider registered under key. connType presets the connection driver type; empty takes it from the request's options or connection.
Types ¶
type SQLOptions ¶ added in v0.1.68
type SQLOptions struct {
// Type overrides the connection driver type (postgres, mysql, sql_server, clickhouse, sqlite).
Type string `json:"type,omitempty"`
// URL is an inline DSN used when no stored connection is referenced.
URL string `json:"url,omitempty"`
// Database overrides the database from the hydrated connection URL.
Database string `json:"database,omitempty"`
}
SQLOptions are the provider-specific knobs decoded from ProviderRequest.Options.
func (SQLOptions) Validate ¶ added in v0.1.68
func (o SQLOptions) Validate() error
Validate refuses a Type that names no SQL engine the provider builds for.
type SQLPageRequest ¶
type SQLPageRequest struct {
// Connection names the connection client is, for the SQL statement tap.
Connection string
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)
Click to show internal directories.
Click to hide internal directories.