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):
I don't want the extra burden of maintaining convertAssign as a public API. I'm going to ask you either continue using the type assert or copy the one function out of database/sql and check on it every couple of years to see if you need to update it.
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,
|
case driver.Rows: |
|
switch d := dest.(type) { |
|
case *Rows: |
|
if d == nil { |
|
return errNilPtr |
|
} |
|
if rows == nil { |
|
return errors.New("invalid context to convert cursor rows, missing parent *Rows") |
|
} |
|
rows.closemu.Lock() |
|
*d = Rows{ |
|
dc: rows.dc, |
|
releaseConn: func(error) {}, |
|
rowsi: s, |
|
} |
|
// Chain the cancel function. |
|
parentCancel := rows.cancel |
|
rows.cancel = func() { |
|
// When Rows.cancel is called, the closemu will be locked as well. |
|
// So we can access rs.lasterr. |
|
d.close(rows.lasterr) |
|
if parentCancel != nil { |
|
parentCancel() |
|
} |
|
} |
|
rows.closemu.Unlock() |
|
return nil |
|
} |
|
} |
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?
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?