Open drbawb opened 11 years ago
Haven't made my way around to working with SQL BLOB types yet, now that you've opened this I'll get on it.
Thanks. I was actually just looking at Arel's visitors and I don't see that they handle BLOB's either. Which makes sense as I'm not sure there's a portable syntax for inserting BLOBs.
At least for Postgres: you could possibly encode the []byte
to a string of hex characters in codex, and then emit SQL to use Postgres' built in decode()
function to have the database transform the varchar
back into a bytea
. e.g: (decode('0a0b0c0d0e0f', 'hex'))
A possible enhancement for inserts & updates.
When passing a Go value of type
[]byte
to codex throughInsert()
orSet()
it returns the error:No visitor method for <[]uint8>.
after callingToSql()
I know the
lib/pq
driver for Postgres natively supports passing[]byte
s as a paramater for columns of typebytea
, and I imagine most other databases would support this as a BLOB though I don't know how their Go driver's handle it.