Closed jwoertink closed 5 years ago
Would you be willing to submit a patch for these types and tests? It should be doable.
the shoddy psql example program helps figure out the binary formats
~/c/crystal-pg (master)> crystal examples/shoddy_psql.cr
# select array[now(),now()]
array
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Bytes[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 4, 160, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 2, 48, 220, 87, 219, 76, 143, 0, 0, 0, 8, 0, 2, 48, 220, 87, 219, 76, 143]
(1 row)
# ⏎
as well as the hexdump in crystal (that I added to help build these binary types and the wire protocol :) ) https://crystal-lang.org/api/0.29.0/IO/Hexdump.html
Then the regular decoders are at https://github.com/will/crystal-pg/blob/master/src/pg/decoder.cr https://github.com/will/crystal-pg/blob/master/spec/pg/decoder_spec.cr to see how most of the binary decoding is done
and the array versions are at https://github.com/will/crystal-pg/blob/master/src/pg/decoders/array_decoder.cr https://github.com/will/crystal-pg/blob/master/spec/pg/decoders/array_decoder_spec.cr
I can take a look. It may be above my skill, but worth a shot! Thanks for the help.
I can do this. It should be pretty easy now that I know how arrays are decoded. I'll probably do it on top of #173
boom! 💥 That's amazing! Great work @asterite thanks so much for tackling that.
When reading out with
__temp_104.read(Array(Time))
I get this error:From looking at that list, I'm gonna assume
Array(UUID)
would also have the same issue. Not sure if those are difficult to add, but just wanted to give a heads up just in case.