Bump reva
This commit is contained in:
committed by
Ralf Haferkamp
parent
17267e899e
commit
2344092b81
+1
@@ -24,6 +24,7 @@ Artur Melanchyk <artur.melanchyk@gmail.com>
|
||||
Asta Xie <xiemengjun at gmail.com>
|
||||
B Lamarche <blam413 at gmail.com>
|
||||
Bes Dollma <bdollma@thousandeyes.com>
|
||||
Bogdan Constantinescu <bog.con.bc at gmail.com>
|
||||
Brian Hendriks <brian at dolthub.com>
|
||||
Bulat Gaifullin <gaifullinbf at gmail.com>
|
||||
Caine Jette <jette at alum.mit.edu>
|
||||
|
||||
+11
@@ -1,5 +1,16 @@
|
||||
# Changelog
|
||||
|
||||
## v1.9.1 (2025-03-21)
|
||||
|
||||
### Major Changes
|
||||
|
||||
* Add Charset() option. (#1679)
|
||||
|
||||
### Bugfixes
|
||||
|
||||
* go.mod: fix go version format (#1682)
|
||||
* Fix FormatDSN missing ConnectionAttributes (#1619)
|
||||
|
||||
## v1.9.0 (2025-02-18)
|
||||
|
||||
### Major Changes
|
||||
|
||||
+20
-1
@@ -44,7 +44,6 @@ type Config struct {
|
||||
DBName string // Database name
|
||||
Params map[string]string // Connection parameters
|
||||
ConnectionAttributes string // Connection Attributes, comma-delimited string of user-defined "key:value" pairs
|
||||
charsets []string // Connection charset. When set, this will be set in SET NAMES <charset> query
|
||||
Collation string // Connection collation. When set, this will be set in SET NAMES <charset> COLLATE <collation> query
|
||||
Loc *time.Location // Location for time.Time values
|
||||
MaxAllowedPacket int // Max packet size allowed
|
||||
@@ -81,6 +80,7 @@ type Config struct {
|
||||
beforeConnect func(context.Context, *Config) error // Invoked before a connection is established
|
||||
pubKey *rsa.PublicKey // Server public key
|
||||
timeTruncate time.Duration // Truncate time.Time values to the specified duration
|
||||
charsets []string // Connection charset. When set, this will be set in SET NAMES <charset> query
|
||||
}
|
||||
|
||||
// Functional Options Pattern
|
||||
@@ -135,6 +135,21 @@ func EnableCompression(yes bool) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// Charset sets the connection charset and collation.
|
||||
//
|
||||
// charset is the connection charset.
|
||||
// collation is the connection collation. It can be null or empty string.
|
||||
//
|
||||
// When collation is not specified, `SET NAMES <charset>` command is sent when the connection is established.
|
||||
// When collation is specified, `SET NAMES <charset> COLLATE <collation>` command is sent when the connection is established.
|
||||
func Charset(charset, collation string) Option {
|
||||
return func(cfg *Config) error {
|
||||
cfg.charsets = []string{charset}
|
||||
cfg.Collation = collation
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func (cfg *Config) Clone() *Config {
|
||||
cp := *cfg
|
||||
if cp.TLS != nil {
|
||||
@@ -307,6 +322,10 @@ func (cfg *Config) FormatDSN() string {
|
||||
writeDSNParam(&buf, &hasParam, "columnsWithAlias", "true")
|
||||
}
|
||||
|
||||
if cfg.ConnectionAttributes != "" {
|
||||
writeDSNParam(&buf, &hasParam, "connectionAttributes", url.QueryEscape(cfg.ConnectionAttributes))
|
||||
}
|
||||
|
||||
if cfg.compress {
|
||||
writeDSNParam(&buf, &hasParam, "compress", "true")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user