fromsql

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateProjectVersion added in v1.0.4

func GenerateProjectVersion(ctx context.Context, params GenerateRequest) (*nemgen.ProjectVersion, error)

func GenerateSQL added in v1.0.4

func GenerateSQL(ctx context.Context, params GenerateRequest) (*tosql.GenerateResponse, error)

func New

func New(params GenerateRequest) *sqlremote

Types

type DB added in v1.0.73

type DB interface {
	// Select scans a result set into a slice destination. Accepts both
	// scalar slices (`*[]string`) and struct slices with `db:"col"` tags,
	// matching sqlx's behavior.
	Select(dest interface{}, query string, args ...interface{}) error

	// QueryMaps returns each row as a column-name → value map. Used by the
	// sample-data path where the result schema isn't known at compile time.
	QueryMaps(query string, args ...interface{}) ([]map[string]interface{}, error)
}

DB is the minimal database surface fromsql needs to introspect a live SQL schema. It's intentionally narrow so that callers can satisfy it via any underlying transport — a direct *sqlx.DB for remote connections, or a LocalAgentChannel-routed adapter for agent-backed local connections.

Caller responsibility: each method may be invoked with no explicit context, so the underlying transport should use a reasonable default deadline.

func FromSqlx added in v1.0.73

func FromSqlx(db *sqlx.DB) DB

FromSqlx wraps an existing *sqlx.DB so it satisfies the DB interface. Used by callers that already hold a concrete sqlx connection (remote DB paths, in-tree test rigs, etc.). LocalAgentConnection callers should NOT go through this — they have their own adapter that routes via the agent stream.

type GenerateRequest added in v1.0.3

type GenerateRequest struct {
	UserConnection *nemgen.UserConnection
	DB             DB
	DBType         db.DBType
	Version        *int64
}

Jump to

Keyboard shortcuts

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