-
I was previously using ReadAt/WriteAt on the Blob struct. I was curious why you moved away from that API back to to a wrapper that maintains an offset. It seems like ReadAt/WriteAt are a much better fit for the underlying API in sqlite, and I'm having to emulate that behaviour by seeking on the Blob now anyway. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
So the problem is in the specification of
This is emphatically not safe to do with The |
Beta Was this translation helpful? Give feedback.
So the problem is in the specification of
io.ReaderAt
:This is emphatically not safe to do with
*sqlite.Blob
, even in the crawshaw implementation, so implementing those methods seemed like a footgun. I have thought about adding convenience functions that use the underlying API, but then the functions would be specific to*sqlite.Blob
, so you can't use an interface likeio.ReadWriteSeeker
.The
Seek
function is quite lightweight, since it only does bounds checks, so the only real cost is LOC in callers. For heavySeek
users, a custom wrapper at the caller seemed not unduly burdensome to me, so that's where I lan…