Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug: manager settings set blank value option missing #145

Merged
merged 2 commits into from
Aug 14, 2023

Conversation

twz915
Copy link

@twz915 twz915 commented Aug 11, 2023

db, err = manager.New(conf.Dbname, conf.User, conf.Password, conf.Host).Driver(driver).Set(
    manager.SetParseTime(true),
    manager.SetLoc(url.QueryEscape("Asia/Shanghai")),
    manager.SetCharset(conf.Charset),
    manager.SetTimeout(conf.ConnectTimeout),
    manager.SetReadTimeout(conf.ReadTimeout),
    manager.SetWriteTimeout(conf.WriteTimeout),
    manager.SetInterpolateParams(conf.InterpolateParams)).Port(conf.Port).Open(true)

配置 charset=utf8 时的 dsn

TEST_DB:123456@tcp(127.0.0.1:3306)/TEST_DB?parseTime=true&loc=Asia%2FShanghai&charset=utf8&timeout=5s&readTimeout=5s&writeTimeout=5s&interpolateParams=false

不配置 charset=utf8 时的 dsn

TEST_DB:123456@tcp(127.0.0.1:3306)/TEST_DB?timeout=5s&readTimeout=5s&writeTimeout=5s&interpolateParams=false

@twz915 twz915 changed the title fix manager blank fix bug: manager settings set blank value option missing Aug 11, 2023
@caibirdme
Copy link
Contributor

不设置就不传入啊

@twz915
Copy link
Author

twz915 commented Aug 14, 2023

配置的时候,可能用的是结构体,结构体有零值,可能会导致这个问题。
还有,配置时间的时候,万一写错了,这个option 不生效也就罢了,不能前面的 option 都丢失了吧,这还不算 bug 么?@caibirdme

@caibirdme caibirdme merged commit da75d5e into didi:master Aug 14, 2023
1 check passed
@caibirdme
Copy link
Contributor

我理解错你的表述了,MR没问题,这里确实是个bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants