mysql

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FmtTimestampDay    = datetimes.FmtTimestampDay
	FmtTimestampHour   = datetimes.FmtTimestampHour
	FmtTimestampMinute = datetimes.FmtTimestampMinute
	FmtDateTime        = datetimes.FmtDateTime
	FmtDate            = datetimes.FmtDate
	FmtTime            = datetimes.FmtTime

	// mysql datetime format strings
	MySQLFmtDatetime = "%Y-%m-%d %H:%i:%s"
	MySQLFmtMinute   = "%Y-%m-%d %H:%i"
	MySQLFmtHour     = "%Y-%m-%d %H"
	MySQLFmtDay      = "%Y-%m-%d"
)
View Source
const (
	ERR_UNDEFINED_DSN = "connection error: MySQL DSN '%s' is undefined\n"
)

Variables

This section is empty.

Functions

func Connect

func Connect(dsn string, tls TLSOption, opts ...Option) *sql.DB

Connect connects to the given DSN and fails quietly

func ConnectENV

func ConnectENV(dsn string, tls TLSOption, opts ...Option) *sql.DB

ConnectENV connects to the DSN at the given ENV VAR and fails quietly

func MustConnect

func MustConnect(dsn string, tls TLSOption, opts ...Option) *sql.DB

MustConnect connects to the given DSN and fails loudly if unable to do so.

func MustConnectENV

func MustConnectENV(dsn string, tls TLSOption, opts ...Option) *sql.DB

MustConnectENV connects to the DSN at the given ENV VAR and fails loudly if unable to do so.

func ParseMySQLDateTime

func ParseMySQLDateTime(t string) time.Time

Types

type Option

type Option func(db *sql.DB) error

func ConnMaxLifetime

func ConnMaxLifetime(d time.Duration) Option

func MaxIdleConnections

func MaxIdleConnections(conns int) Option

func MaxOpenConnections

func MaxOpenConnections(conns int) Option

type TLSOption

type TLSOption func() error

func TLS

func TLS(configName, certPath string) TLSOption

Jump to

Keyboard shortcuts

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