db

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectType added in v0.6.0

func DetectType(dsn string) string

DetectType returns the database type string for a given DSN.

func DisplayName added in v0.6.0

func DisplayName(dsn string) string

DisplayName returns a short display name for a DSN.

func InitialQuery added in v0.6.0

func InitialQuery(dbType string) string

InitialQuery returns an appropriate initial query for the database type.

func MaskDSN added in v0.6.0

func MaskDSN(dsn string) string

MaskDSN returns a display-safe version of the DSN with passwords masked.

func Placeholder added in v0.6.0

func Placeholder(dbType string) string

Placeholder returns an appropriate placeholder query for the database type.

Types

type DBAdapter

type DBAdapter interface {
	Type() string
	Query(context.Context, string) (QueryResult, error)
	Tables(context.Context) ([]string, error)
	Columns(ctx context.Context, tableName string) ([]string, error)
	Schema(context.Context) (string, error)
	QuoteIdentifier(name string) string
	Close() error
}

type QueryResult

type QueryResult struct {
	Columns     []string
	ColumnTypes []string // e.g. "INTEGER", "TEXT", "VARCHAR". nil if unavailable.
	Rows        [][]string
	Message     string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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