hostedemu

package
v3.18.41 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BackendCapture = "capture"
	BackendDuckDB  = "duckdb"

	FallbackPlaceholderOnError = "placeholder_on_error"
	FallbackStrict             = "strict"

	DiscoveryInformationSchema = "information_schema"
	DiscoveryShow              = "show"
)

Variables

This section is empty.

Functions

func CapturePath

func CapturePath(dir, testName string) string

func NamedValues

func NamedValues(args []driver.NamedValue) []any

func NewConnector

func NewConnector(conf Config, adapter Adapter) driver.Connector

func NormalizeBackend

func NormalizeBackend(backend string) string

func NormalizeDiscovery

func NormalizeDiscovery(discovery string) string

func NormalizeFallback

func NormalizeFallback(fallback string) string

func NormalizeSQL

func NormalizeSQL(query string) string

Types

type Adapter

type Adapter interface {
	Name() string
	DefaultSeedPath() string
	ParseSeed(seedSQL string) (any, error)
	NewSession(catalog any) Session
	TranslateSetup(seedSQL string, catalog any) ([]string, error)
	TranslateDiscoveryQuery(sql string, args []driver.NamedValue, catalog any) (string, []driver.NamedValue, error)
	TranslateDiscoveryExec(sql string, args []driver.NamedValue, catalog any) ([]string, []driver.NamedValue, error)
	TranslateRuntime(sql string, args []driver.NamedValue, catalog any) (string, []driver.NamedValue, error)
	TranslateDirect(sql string, args []driver.NamedValue, catalog any) (string, []driver.NamedValue, error)
	NormalizeIdentifier(identifier string) string
	MapType(sourceType string) string
	ClassifyPhase(sql string) string
}

type CatalogMutator

type CatalogMutator interface {
	ApplyDDL(sql string)
}

type Config

type Config struct {
	SeedPath   string
	CaptureDir string
	TestName   string
	RunID      string
	Backend    string
	Fallback   string
	Discovery  string
}

type DiscoveryConfigurer

type DiscoveryConfigurer interface {
	SetDiscoveryMode(mode string)
}

type MetadataRefresher

type MetadataRefresher interface {
	TranslateMetadataRefresh(catalog any) ([]string, error)
}

type QueryIDTracker added in v3.18.30

type QueryIDTracker interface {
	// IsQueryIDProducer reports whether sql sets the session's last query id.
	IsQueryIDProducer(sql string) bool
	// IsQueryIDQuery reports whether sql reads the session's last query id.
	IsQueryIDQuery(sql string) bool
	// CaptureQueryIDSQL returns a one-row, one-column query for the current id.
	CaptureQueryIDSQL() string
}

QueryIDTracker is an optional Adapter capability for dialects (Snowflake) whose discovery reads a prior statement's result back via a session-scoped query id (LAST_QUERY_ID() + RESULT_SCAN). The harness captures the id per connection so concurrent discoveries don't race on shared emulator session state. Adapters that don't implement it (BigQuery) are unaffected.

type Rows

type Rows struct {
	// contains filtered or unexported fields
}

func NewRows

func NewRows(cols []string, vals ...[]driver.Value) *Rows

func (*Rows) Close

func (r *Rows) Close() error

func (*Rows) Columns

func (r *Rows) Columns() []string

func (*Rows) Len

func (r *Rows) Len() int

func (*Rows) Next

func (r *Rows) Next(dest []driver.Value) error

type Session

type Session interface {
	PlaceholderQuery(sql string) (*Rows, string, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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