Skip to content

Commit 469939d

Browse files
committed
added wide_time_types to dsn parser
1 parent c78b3a5 commit 469939d

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

dsn.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ func parseConnectionString(dataSourceName string) (opts []Option, _ error) {
114114
binders = append(binders, xsql.WithQueryBind(bind.PositionalArgs{}))
115115
case "numeric":
116116
binders = append(binders, xsql.WithQueryBind(bind.NumericArgs{}))
117+
case "wide_time_types":
118+
binders = append(binders, xsql.WithQueryBind(bind.WideTimeTypes{}))
117119
default:
118120
if strings.HasPrefix(transformer, tablePathPrefixTransformer) {
119121
prefix, err := extractTablePathPrefixFromBinderName(transformer)

dsn_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,21 @@ func TestParse(t *testing.T) {
171171
},
172172
err: nil,
173173
},
174+
{
175+
dsn: "grpc://localhost:2135/local?query_mode=scripting&go_query_bind=positional,declare,wide_time_types", //nolint:lll
176+
opts: []config.Option{
177+
config.WithSecure(false),
178+
config.WithEndpoint("localhost:2135"),
179+
config.WithDatabase("/local"),
180+
},
181+
connectorOpts: []xsql.Option{
182+
xsql.WithDefaultQueryMode(xtable.ScriptingQueryMode),
183+
xsql.WithQueryBind(bind.PositionalArgs{}),
184+
xsql.WithQueryBind(bind.AutoDeclare{}),
185+
xsql.WithQueryBind(bind.WideTimeTypes{}),
186+
},
187+
err: nil,
188+
},
174189
} {
175190
t.Run("", func(t *testing.T) {
176191
opts, err := parseConnectionString(tt.dsn)

0 commit comments

Comments
 (0)