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

database/sql/driver: DefaultParameterConverter does not handle reflect.String #10020

Closed
tpng opened this issue Feb 27, 2015 · 2 comments
Closed

Comments

@tpng
Copy link

tpng commented Feb 27, 2015

Currently inside http://golang.org/src/database/sql/driver/types.go#L230 (switch rv.Kind()), case reflect.String is not handled.
As a result, type like the following can not be scanned without implementing the Valuer interface.

type Test string
func (t Test) Value() (driver.Value, error) {
    return driver.String.ConvertValue(c)
}

Is it possible to add reflect.String case to the DefaultParameterConverter so the clients of the sql library does not need to implement the Valuer interface themselves?

@bradfitz
Copy link
Contributor

bradfitz commented Mar 2, 2015

I'd rather not go down that road and add more. I think it does enough as it is.

@bradfitz bradfitz closed this as completed Mar 2, 2015
@theory
Copy link

theory commented Nov 21, 2015

Gotta say, I think that adding String would be a big help, making it easier to transparently use a whole lotta types without any further work.

@golang golang locked and limited conversation to collaborators Nov 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants