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: should copy into []byte by default; add RawBytes type for speed #2698

Closed
bradfitz opened this issue Jan 13, 2012 · 2 comments
Closed

Comments

@bradfitz
Copy link
Contributor

Row.Scan into a *[]byte does a copy.
Rows.Scan into a *[]byte does NOT.  (our original plan was speed)

for paranoia and consistency, Rows.Scan should also do a copy.

if the caller wants to minimize allocations, they can use a new named []byte type,
RawBytes

type RawBytes []byte

... and only Rows.Scan will permit that.
@bradfitz
Copy link
Contributor Author

Comment 1:

http://golang.org/cl/5539060/

@bradfitz
Copy link
Contributor Author

Comment 2:

This issue was closed by revision ebc8013.

Status changed to Fixed.

@bradfitz bradfitz self-assigned this Jan 17, 2012
@mikioh mikioh changed the title exp/sql should copy into []byte by default; add RawBytes type for speed database/sql: should copy into []byte by default; add RawBytes type for speed Feb 18, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
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

2 participants