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

sql

package
v1.17.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindNamed

func BindNamed(query string, args any, querier sqlx.ExtContext) (string, []any, error)

func OpenDB

func OpenDB(driverName, dsn, user, pass string, tlsConfig *tls.Config) (*sqlx.DB, error)

Types

type Connector added in v1.14.0

type Connector struct {
	Driver               string        `mapstructure:"driver"`
	Dsn                  string        `mapstructure:"dsn"`
	Username             string        `mapstructure:"username"`
	Password             string        `mapstructure:"password"`
	ConnsMaxIdleTime     time.Duration `mapstructure:"conns_max_idle_time"`
	ConnsMaxLifetime     time.Duration `mapstructure:"conns_max_life_time"`
	ConnsMaxOpen         int           `mapstructure:"conns_max_open"`
	ConnsMaxIdle         int           `mapstructure:"conns_max_idle"`
	QueryTimeout         time.Duration `mapstructure:"query_timeout"`
	*tls.TLSClientConfig `mapstructure:",squash"`
}

func (*Connector) Init added in v1.14.0

func (c *Connector) Init() (*sqlx.DB, error)

type QueryInfo

type QueryInfo struct {
	Query string `mapstructure:"query"`
	File  string `mapstructure:"file"`
}

func (*QueryInfo) Init

func (q *QueryInfo) Init(required bool) error

Jump to

Keyboard shortcuts

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