Documentation ¶
Overview ¶
This package implements database/sql/driver interface, so we can use go-mysql with database/sql
Index ¶
- func AddNamedValueChecker(nvCheckFunc ...CheckNamedValueFunc)
- func CollationOption(c *client.Conn, value string) error
- func CompressOption(c *client.Conn, value string) error
- func ReadTimeoutOption(c *client.Conn, value string) error
- func SetCustomTLSConfig(dsn string, caPem []byte, certPem []byte, keyPem []byte, ...) error
- func SetDSNOptions(customOptions map[string]DriverOption)
- func UseSslOption(c *client.Conn) error
- func WriteTimeoutOption(c *client.Conn, value string) error
- type CheckNamedValueFunc
- type DriverOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddNamedValueChecker ¶
func AddNamedValueChecker(nvCheckFunc ...CheckNamedValueFunc)
AddNamedValueChecker sets a custom NamedValueChecker for the driver connection which allows for more control in handling Go and database types beyond the default Value types. See https://pkg.go.dev/database/sql/driver#NamedValueChecker Usage requires a full import of the driver (not by side-effects only). Also note that this function is not concurrent-safe, and should only be executed while setting up the driver before establishing any connections via `sql.Open()`.
func SetCustomTLSConfig ¶
func SetCustomTLSConfig(dsn string, caPem []byte, certPem []byte, keyPem []byte, insecureSkipVerify bool, serverName string) error
SetCustomTLSConfig sets a custom TLSConfig for the address (host:port) of the supplied DSN. It requires a full import of the driver (not by side-effects only). Example of supplying a custom CA, no client cert, no key, validating the certificate, and supplying a serverName for the validation:
driver.SetCustomTLSConfig(CaPem, make([]byte, 0), make([]byte, 0), false, "my.domain.name")
func SetDSNOptions ¶
func SetDSNOptions(customOptions map[string]DriverOption)
SetDSNOptions sets custom options to the driver that allows modifications to the connection. It requires a full import of the driver (not by side-effects only). Example of supplying a custom option:
driver.SetDSNOptions(map[string]DriverOption{ "my_option": func(c *client.Conn, value string) error { c.SetCapability(mysql.CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS) return nil }, })
func UseSslOption ¶
Types ¶
type CheckNamedValueFunc ¶
type CheckNamedValueFunc func(*sqldriver.NamedValue) error