From e075432c409c4dde7794e26584fdb9a238c79b44 Mon Sep 17 00:00:00 2001 From: HaiLaz <739476267@qq.com> Date: Thu, 25 May 2023 22:00:57 +0800 Subject: [PATCH] comment update for package `contrib/drivers/mysql` (#2649) --- contrib/drivers/mysql/mysql.go | 1 + database/gdb/gdb_core_config.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/drivers/mysql/mysql.go b/contrib/drivers/mysql/mysql.go index 2393d679a..36e41764d 100644 --- a/contrib/drivers/mysql/mysql.go +++ b/contrib/drivers/mysql/mysql.go @@ -76,6 +76,7 @@ func (d *Driver) Open(config *gdb.ConfigNode) (db *sql.DB, err error) { source, _ = gregex.ReplaceString(`/([\w\.\-]+)+`, "/"+config.Name, source) } } else { + // TODO: Do not set charset when charset is not specified (in v2.5.0) source = fmt.Sprintf( "%s:%s@%s(%s:%s)/%s?charset=%s", config.User, config.Pass, config.Protocol, config.Host, config.Port, config.Name, config.Charset, diff --git a/database/gdb/gdb_core_config.go b/database/gdb/gdb_core_config.go index 493633a1e..1b2edca5a 100644 --- a/database/gdb/gdb_core_config.go +++ b/database/gdb/gdb_core_config.go @@ -38,7 +38,7 @@ type ConfigNode struct { Prefix string `json:"prefix"` // (Optional) Table prefix. DryRun bool `json:"dryRun"` // (Optional) Dry run, which does SELECT but no INSERT/UPDATE/DELETE statements. Weight int `json:"weight"` // (Optional) Weight for load balance calculating, it's useless if there's just one node. - Charset string `json:"charset"` // (Optional, "utf8mb4" in default) Custom charset when operating on database. + Charset string `json:"charset"` // (Optional, "utf8" in default) Custom charset when operating on database. Protocol string `json:"protocol"` // (Optional, "tcp" in default) See net.Dial for more information which networks are available. Timezone string `json:"timezone"` // (Optional) Sets the time zone for displaying and interpreting time stamps. Namespace string `json:"namespace"` // (Optional) Namespace for some databases. Eg, in pgsql, the `Name` acts as the `catalog`, the `NameSpace` acts as the `schema`.