dbquery

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(ctx context.Context, target Target, dbType, database, statement string, opts Options) (map[string]any, error)

Execute runs a statement against a resolved target.

Types

type Options

type Options struct {
	FallbackUser     string
	FallbackPassword string
	Masker           mask.Masker
	ApplyPII         bool
	MaxRows          int
	Timeout          time.Duration
	EnforceReadOnly  bool
}

Options configures local query execution.

type Result

type Result struct {
	Status  string           `json:"status"`
	Results map[string]any   `json:"results,omitempty"`
	Data    []map[string]any `json:"data,omitempty"`
	Columns []string         `json:"columns,omitempty"`
}

Result is the tabular execute payload shared by Studio dispatch and db_query_* tools.

type Target

type Target struct {
	DBType       string `json:"db_type"`
	AWSAccountID string `json:"aws_account_id"`
	DatabaseName string `json:"database_name"`
	Host         string `json:"host"`
	User         string `json:"user,omitempty"`
	Password     string `json:"password,omitempty"`
	SSLMode      string `json:"sslmode,omitempty"` // postgres
	Name         string `json:"name,omitempty"`    // optional logical name (wire targets)
}

Target declares a database the edge can reach for one-shot exec or Studio dispatch.

func MergeWireTargets

func MergeWireTargets(studio []Target, wire []tunnel.Target) []Target

MergeWireTargets appends tunnel.Target entries (SKYBRIDGE_TARGETS wire-proxy shape) as exec targets.

func ParseTargets

func ParseTargets(raw string) []Target

ParseTargets decodes SKYBRIDGE_STUDIO_TARGETS / SKYBRIDGE_TARGETS JSON arrays.

func Resolve

func Resolve(targets []Target, dbType, account, database string) (Target, bool)

Resolve picks the first target matching db_type + scope + database.

Jump to

Keyboard shortcuts

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