Skip to content

Commit 8644886

Browse files
asmyasnikovCopilot
andauthored
Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 2a25882 commit 8644886

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

sql.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,8 @@ func WithAutoDeclare() QueryBindConnectorOption {
214214
//
215215
// connector, err := ydb.Connector(driver, ydb.WithCustomConverter(&MyCustomConverter{}))
216216
func WithCustomConverter(converter bind.Converter) QueryBindConnectorOption {
217-
bind.RegisterConverter(converter)
218-
219-
return xsql.WithQueryBind(bind.CustomConverter{})
217+
// Register the converter in a connector-scoped way by passing it as an option.
218+
return xsql.WithQueryBind(bind.CustomConverter{Converter: converter})
220219
}
221220

222221
// WithCustomNamedValueConverter registers a custom named value converter for database/sql query parameters
@@ -237,11 +236,9 @@ func WithCustomConverter(converter bind.Converter) QueryBindConnectorOption {
237236
//
238237
// connector, err := ydb.Connector(driver, ydb.WithCustomNamedValueConverter(&MyNamedConverter{}))
239238
func WithCustomNamedValueConverter(converter bind.NamedValueConverter) QueryBindConnectorOption {
240-
bind.RegisterNamedValueConverter(converter)
241-
242-
return xsql.WithQueryBind(bind.CustomNamedValueConverter{})
239+
// Instead of global registration, return a per-connector option carrying the converter.
240+
return xsql.WithQueryBind(bind.CustomNamedValueConverter{Converter: converter})
243241
}
244-
245242
func WithPositionalArgs() QueryBindConnectorOption {
246243
return xsql.WithQueryBind(bind.PositionalArgs{})
247244
}

0 commit comments

Comments
 (0)