mysql

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 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 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 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 added in v0.2.0

type Option func(db *sql.DB) error

func ConnMaxLifetime added in v0.2.0

func ConnMaxLifetime(conns int) Option

func MaxIdleConnections added in v0.2.0

func MaxIdleConnections(conns int) Option

func MaxOpenConnections added in v0.2.0

func MaxOpenConnections(conns int) Option

type TLSOption added in v0.2.0

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