-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
proposal: database/sql: export convertAssign as DefaultConvertAssign #62146
Comments
FYI: I would like to use that function in my project and we've tried to copy'n'paste that, but we faced such issue in copying. |
CC @kardianos |
What are the types that you want to pass to the proposed function? |
@ianlancetaylor actually, the type would be any; like https://github.com/moznion/go-optional/blob/c95f59ccbec4a6dab276f0ad80349cf989f1907e/sql_driver.go#L15-L19 |
I mean, what would the dynamic type be? What type would be stored in the interface? What I'm trying to get at is: when would people want to use this? Do you have an example of code that is currently copying it? Thanks. |
Actually, this is my use case but I'm developing the optional type library for golang and it would be nicer to implement |
I ran into the same problem. The addition of The omission of |
I think it would help if somebody could write the documentation for the proposed function. The current documentation for the unexported function is pretty short and does not explain why anybody would want to use the function. Thanks. |
I looked at where convertAssign is used throughout the database/sql package, and found that |
Related: ariga/entcache#34 |
As discussed in #24258 and #35697, but I think it would be nicer to have the exposed
sql.convertAssign()
function.In the previous suggestion, @kardianos said at #24258 (comment):
and @rsc also said as well at #35697 (comment), i.e. they suggested doing copy the
sql.convertAssign()
to the user's project.At the date of the first suggestion, Apr 20, 2018, copying was a good solution because that function hadn't accessed the unexposed value and functions; ref: https://github.com/golang/go/blob/da24c95ce09668a0d977c208e8e610a21b98b019/src/database/sql/convert.go
However, that function touches the unexported items in the current implementation; for example,
go/src/database/sql/convert.go
Lines 319 to 347 in 9ac6b00
I suppose this implies users have not been able to copy this function simply so copying would be no longer an effective way to satisfy the demand. Can we have a chance to reboot exposure for this
sql.convertAssign()
function?The text was updated successfully, but these errors were encountered: