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

sql

package
v0.0.0-...-24627df Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseConnDef

func CloseConnDef(name string) (err error)

func ConnDefinitions

func ConnDefinitions() (condefs []string)

func ConnStats

func ConnStats(name string) (stats map[string]any)

func Exec

func Exec(name, query string, a ...any) (resut sql.Result, err error)

func ExecContext

func ExecContext(ctx context.Context, name, query string, a ...any) (result sql.Result, err error)

func NumberedRecords

func NumberedRecords(rows SqlRows) func(func(Record, int64) bool)

func Records

func Records(rows SqlRows) func(func(Record) bool)

func Register

func Register(name string, driver sqldriver.Driver, dvrparsesql snksqldvr.DriverParseSql) (err error)

Types

type ConnDefinition

type ConnDefinition interface {
	Query(query string, a ...any) (rows SqlRows, err error)
	QueryContext(ctx context.Context, query string, a ...any) (rows SqlRows, err error)
	Exec(query string, a ...any) (result sql.Result, err error)
	ExecContext(ctx context.Context, query string, a ...any) (result sql.Result, err error)
	Close() error
	Stats() sql.DBStats
}

func DefineConn

func DefineConn(name, datasource string) (conndef ConnDefinition, err error)

type FormatQuery

type FormatQuery interface {
	FprintQuery(out io.Writer, name, driver, query string, a ...any) (err error)
}
var GlobalFormatQuery FormatQuery

type FormatQueryFunc

type FormatQueryFunc func(out io.Writer, name, driver, query string, a ...any) (err error)

func (FormatQueryFunc) FprintQuery

func (fmtqryfnc FormatQueryFunc) FprintQuery(out io.Writer, name, driver, query string, a ...any) (err error)

type Record

type Record interface {
	Nr() int64
	Columns() []string
	Data() []any
	First() bool
	Last() bool
	Init() bool
	Finit() bool
	Err() error
	Value(int, ...any) (any, bool)
	Index(string) int
}

type SQLHandler

type SQLHandler interface {
	Query(name string, query string, a ...any) (records func(func(Record, int64) bool), err error)
	Exec(name string, query string, a ...any) (any, error)
	Stats(name string) (stats any)
	Conns() []string
	DefineConn(name string, datasource string) (conndef ConnDefinition, err error)
}

func InvokeSQLHandler

func InvokeSQLHandler(ctx context.Context, formatQuery FormatQueryFunc, params parameters.Parameters) SQLHandler

type SqlRows

type SqlRows interface {
	Close() error
	ColumnTypes() ([]*sql.ColumnType, error)
	Columns() ([]string, error)
	Err() error
	Next() bool
	NextResultSet() bool
	Scan(dest ...any) error
}

func Query

func Query(name, query string, a ...any) (rows SqlRows, err error)

func QueryContext

func QueryContext(ctx context.Context, name, query string, a ...any) (rows SqlRows, err error)

func SqlRowsConnCloser

func SqlRowsConnCloser(rows *sql.Rows, cn *sql.Conn) SqlRows

Directories

Path Synopsis
ora

Jump to

Keyboard shortcuts

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