Help us shape the future of Go! Take the 2026 Go Developer Survey

dbtarget

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection added in v1.1.0

type Connection struct {
	DB      *sql.DB
	Dialect string
	Schema  string
}

Connection is an open, pinged database with its resolved dialect and schema.

func Open added in v1.1.0

func Open(ctx context.Context, opts OpenOptions) (Connection, error)

Open resolves a named connection, normalizes the driver and DSN, and pings the database. SQLite opens read-only or read-write as requested.

type Dialect

type Dialect string
const (
	Postgres  Dialect = "postgres"
	SQLite    Dialect = "sqlite"
	SQLServer Dialect = "sqlserver"
)

type OpenOptions added in v1.1.0

type OpenOptions struct {
	// DSN is a connection string or connection://[<namespace>/]<name>.
	DSN string
	// Driver overrides the dialect parsed from the DSN; it must agree with it.
	Driver string
	// Schema defaults to main, dbo or public by dialect.
	Schema         string
	ConnectionsDir string
	ReadOnly       bool
}

type Target

type Target struct {
	Dialect Dialect
	DSN     string
}

func Parse

func Parse(raw string) (Target, error)

Jump to

Keyboard shortcuts

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