Documentation ¶
Overview ¶
https://github.com/go-sql-driver/mysql#timetime-support https://github.com/go-sql-driver/mysql#unicode-support
Package mysql transaction
Index ¶
- type Client
- type MySql
- type Option
- func Charset(charset string) Option
- func Collation(collation string) Option
- func ConnMaxLifetime(d time.Duration) Option
- func Debug(d bool) Option
- func Loc(s string) Option
- func MaxIdleConnections(i int) Option
- func MaxOpenConnections(i int) Option
- func ParseTime(parseTime bool) Option
- func ReadTimeout(readTimeout time.Duration) Option
- func TLS(tls bool) Option
- func TablePrefix(s string) Option
- func Timeout(timeout time.Duration) Option
- func WriteTimeout(writeTimeout time.Duration) Option
- type TxDB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option configures MySql using the functional options paradigm popularized by Rob Pike and Dave Cheney.
func Charset ¶
Charset Sets the charset used for client-server interaction ("SET NAMES <value>"). If multiple charsets are set (separated by a comma), the following charset is used if setting the charset failes. This enables for example support for utf8mb4 (introduced in MySQL 5.5.3) with fallback to utf8 for older servers (charset=utf8mb4,utf8). Usage of the charset parameter is discouraged because it issues additional queries to the server. Unless you need the fallback behavior, please use collation instead. https://github.com/go-sql-driver/mysql#charset
func Collation ¶ added in v0.0.4
Collation Sets the collation used for client-server interaction on connection. In contrast to charset, collation does not issue additional queries. If the specified collation is unavailable on the target server, the connection will fail. A list of valid charsets for a server is retrievable with SHOW COLLATION. The default collation (utf8mb4_general_ci) is supported from MySQL 5.5. You should use an older collation (e.g. utf8_general_ci) for older MySQL. https://github.com/go-sql-driver/mysql#collation
func ConnMaxLifetime ¶
ConnMaxLifetime connection max lifetime https://github.com/go-sql-driver/mysql#connection-pool-and-timeouts
func Loc ¶
Loc Sets the location for time.Time values (when using parseTime=true). "Local" sets the system's location. https://github.com/go-sql-driver/mysql#loc
func MaxIdleConnections ¶
MaxIdleConnections max idle connections https://github.com/go-sql-driver/mysql#connection-pool-and-timeouts
func MaxOpenConnections ¶
MaxOpenConnections max open connections https://github.com/go-sql-driver/mysql#connection-pool-and-timeouts
func ParseTime ¶
ParseTime parseTime=true changes the output type of DATE and DATETIME values to time.Time instead of []byte / string The date or datetime like 0000-00-00 00:00:00 is converted into zero value of time.Time. https://github.com/go-sql-driver/mysql#parsetime
func ReadTimeout ¶ added in v0.0.4
ReadTimeout I/O read timeout. The value must be a decimal number with a unit suffix ("ms", "s", "m", "h"), such as "30s", "0.5m" or "1m30s".
func TLS ¶ added in v0.0.4
TLS tls=true enables TLS / SSL encrypted connection to the server. Use skip-verify if you want to use a self-signed or invalid certificate (server side) or use preferred to use TLS only when advertised by the server. This is similar to skip-verify, but additionally allows a fallback to a connection which is not encrypted. Neither skip-verify nor preferred add any reliable security. You can use a custom TLS config after registering it with mysql.RegisterTLSConfig.
func Timeout ¶ added in v0.0.4
Timeout for establishing connections, aka dial timeout. The value must be a decimal number with a unit suffix ("ms", "s", "m", "h"), such as "30s", "0.5m" or "1m30s".
func WriteTimeout ¶ added in v0.0.4
WriteTimeout I/O write timeout. The value must be a decimal number with a unit suffix ("ms", "s", "m", "h"), such as "30s", "0.5m" or "1m30s". Default 0