Closed gabrieligbastos closed 1 month ago
I tried to understand what was being sent byte by byte, was this:
Decoded string: "B\0\0\0\0\0s10\0\0\u{1}\0\u{1}\0\0\0\0\0\0\0\0\0\u{1}\0\0\0\0\0\0\0\u{19}\0\0\0\n\0\0\0\u{1}\0\0\0\u{18}{should_fail_at_9,false}\0\0\0\u{19}{should_fail_at_10,false}\0\0\0\u{17}{should_fail_at_3,true}\0\0\0\u{18}{should_fail_at_2,false}\0\0\0\u{18}{should_fail_at_7,false}\0\0\0\u{18}{should_fail_at_6,false}\0\0\0\u{18}{should_fail_at_4,false}\0\0\0\u{18}{should_fail_at_5,false}\0\0\0\u{19}{should_fail_at_11,false}\0\0\0\0{should_fail_at_8,false}"
Byte: 42, Char: 'B'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 73, Char: 's'
Byte: 31, Char: '1'
Byte: 30, Char: '0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 01, Char: '\u{1}'
Byte: 00, Char: '\0'
Byte: 01, Char: '\u{1}'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 01, Char: '\u{1}'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 19, Char: '\u{19}'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 0a, Char: '\n'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 01, Char: '\u{1}'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 18, Char: '\u{18}'
Byte: 7b, Char: '{'
Byte: 73, Char: 's'
Byte: 68, Char: 'h'
Byte: 6f, Char: 'o'
Byte: 75, Char: 'u'
Byte: 6c, Char: 'l'
Byte: 64, Char: 'd'
Byte: 5f, Char: '_'
Byte: 66, Char: 'f'
Byte: 61, Char: 'a'
Byte: 69, Char: 'i'
Byte: 6c, Char: 'l'
Byte: 5f, Char: '_'
Byte: 61, Char: 'a'
Byte: 74, Char: 't'
Byte: 5f, Char: '_'
Byte: 39, Char: '9'
Byte: 2c, Char: ','
Byte: 66, Char: 'f'
Byte: 61, Char: 'a'
Byte: 6c, Char: 'l'
Byte: 73, Char: 's'
Byte: 65, Char: 'e'
Byte: 7d, Char: '}'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 19, Char: '\u{19}'
Byte: 7b, Char: '{'
Byte: 73, Char: 's'
Byte: 68, Char: 'h'
Byte: 6f, Char: 'o'
Byte: 75, Char: 'u'
Byte: 6c, Char: 'l'
Byte: 64, Char: 'd'
Byte: 5f, Char: '_'
Byte: 66, Char: 'f'
Byte: 61, Char: 'a'
Byte: 69, Char: 'i'
Byte: 6c, Char: 'l'
Byte: 5f, Char: '_'
Byte: 61, Char: 'a'
Byte: 74, Char: 't'
Byte: 5f, Char: '_'
Byte: 31, Char: '1'
Byte: 30, Char: '0'
Byte: 2c, Char: ','
Byte: 66, Char: 'f'
Byte: 61, Char: 'a'
Byte: 6c, Char: 'l'
Byte: 73, Char: 's'
Byte: 65, Char: 'e'
Byte: 7d, Char: '}'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 17, Char: '\u{17}'
Byte: 7b, Char: '{'
Byte: 73, Char: 's'
Byte: 68, Char: 'h'
Byte: 6f, Char: 'o'
Byte: 75, Char: 'u'
Byte: 6c, Char: 'l'
Byte: 64, Char: 'd'
Byte: 5f, Char: '_'
Byte: 66, Char: 'f'
Byte: 61, Char: 'a'
Byte: 69, Char: 'i'
Byte: 6c, Char: 'l'
Byte: 5f, Char: '_'
Byte: 61, Char: 'a'
Byte: 74, Char: 't'
Byte: 5f, Char: '_'
Byte: 33, Char: '3'
Byte: 2c, Char: ','
Byte: 74, Char: 't'
Byte: 72, Char: 'r'
Byte: 75, Char: 'u'
Byte: 65, Char: 'e'
Byte: 7d, Char: '}'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 18, Char: '\u{18}'
Byte: 7b, Char: '{'
Byte: 73, Char: 's'
Byte: 68, Char: 'h'
Byte: 6f, Char: 'o'
Byte: 75, Char: 'u'
Byte: 6c, Char: 'l'
Byte: 64, Char: 'd'
Byte: 5f, Char: '_'
Byte: 66, Char: 'f'
Byte: 61, Char: 'a'
Byte: 69, Char: 'i'
Byte: 6c, Char: 'l'
Byte: 5f, Char: '_'
Byte: 61, Char: 'a'
Byte: 74, Char: 't'
Byte: 5f, Char: '_'
Byte: 32, Char: '2'
Byte: 2c, Char: ','
Byte: 66, Char: 'f'
Byte: 61, Char: 'a'
Byte: 6c, Char: 'l'
Byte: 73, Char: 's'
Byte: 65, Char: 'e'
Byte: 7d, Char: '}'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 18, Char: '\u{18}'
Byte: 7b, Char: '{'
Byte: 73, Char: 's'
Byte: 68, Char: 'h'
Byte: 6f, Char: 'o'
Byte: 75, Char: 'u'
Byte: 6c, Char: 'l'
Byte: 64, Char: 'd'
Byte: 5f, Char: '_'
Byte: 66, Char: 'f'
Byte: 61, Char: 'a'
Byte: 69, Char: 'i'
Byte: 6c, Char: 'l'
Byte: 5f, Char: '_'
Byte: 61, Char: 'a'
Byte: 74, Char: 't'
Byte: 5f, Char: '_'
Byte: 37, Char: '7'
Byte: 2c, Char: ','
Byte: 66, Char: 'f'
Byte: 61, Char: 'a'
Byte: 6c, Char: 'l'
Byte: 73, Char: 's'
Byte: 65, Char: 'e'
Byte: 7d, Char: '}'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 18, Char: '\u{18}'
Byte: 7b, Char: '{'
Byte: 73, Char: 's'
Byte: 68, Char: 'h'
Byte: 6f, Char: 'o'
Byte: 75, Char: 'u'
Byte: 6c, Char: 'l'
Byte: 64, Char: 'd'
Byte: 5f, Char: '_'
Byte: 66, Char: 'f'
Byte: 61, Char: 'a'
Byte: 69, Char: 'i'
Byte: 6c, Char: 'l'
Byte: 5f, Char: '_'
Byte: 61, Char: 'a'
Byte: 74, Char: 't'
Byte: 5f, Char: '_'
Byte: 36, Char: '6'
Byte: 2c, Char: ','
Byte: 66, Char: 'f'
Byte: 61, Char: 'a'
Byte: 6c, Char: 'l'
Byte: 73, Char: 's'
Byte: 65, Char: 'e'
Byte: 7d, Char: '}'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 18, Char: '\u{18}'
Byte: 7b, Char: '{'
Byte: 73, Char: 's'
Byte: 68, Char: 'h'
Byte: 6f, Char: 'o'
Byte: 75, Char: 'u'
Byte: 6c, Char: 'l'
Byte: 64, Char: 'd'
Byte: 5f, Char: '_'
Byte: 66, Char: 'f'
Byte: 61, Char: 'a'
Byte: 69, Char: 'i'
Byte: 6c, Char: 'l'
Byte: 5f, Char: '_'
Byte: 61, Char: 'a'
Byte: 74, Char: 't'
Byte: 5f, Char: '_'
Byte: 34, Char: '4'
Byte: 2c, Char: ','
Byte: 66, Char: 'f'
Byte: 61, Char: 'a'
Byte: 6c, Char: 'l'
Byte: 73, Char: 's'
Byte: 65, Char: 'e'
Byte: 7d, Char: '}'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 18, Char: '\u{18}'
Byte: 7b, Char: '{'
Byte: 73, Char: 's'
Byte: 68, Char: 'h'
Byte: 6f, Char: 'o'
Byte: 75, Char: 'u'
Byte: 6c, Char: 'l'
Byte: 64, Char: 'd'
Byte: 5f, Char: '_'
Byte: 66, Char: 'f'
Byte: 61, Char: 'a'
Byte: 69, Char: 'i'
Byte: 6c, Char: 'l'
Byte: 5f, Char: '_'
Byte: 61, Char: 'a'
Byte: 74, Char: 't'
Byte: 5f, Char: '_'
Byte: 35, Char: '5'
Byte: 2c, Char: ','
Byte: 66, Char: 'f'
Byte: 61, Char: 'a'
Byte: 6c, Char: 'l'
Byte: 73, Char: 's'
Byte: 65, Char: 'e'
Byte: 7d, Char: '}'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 19, Char: '\u{19}'
Byte: 7b, Char: '{'
Byte: 73, Char: 's'
Byte: 68, Char: 'h'
Byte: 6f, Char: 'o'
Byte: 75, Char: 'u'
Byte: 6c, Char: 'l'
Byte: 64, Char: 'd'
Byte: 5f, Char: '_'
Byte: 66, Char: 'f'
Byte: 61, Char: 'a'
Byte: 69, Char: 'i'
Byte: 6c, Char: 'l'
Byte: 5f, Char: '_'
Byte: 61, Char: 'a'
Byte: 74, Char: 't'
Byte: 5f, Char: '_'
Byte: 31, Char: '1'
Byte: 31, Char: '1'
Byte: 2c, Char: ','
Byte: 66, Char: 'f'
Byte: 61, Char: 'a'
Byte: 6c, Char: 'l'
Byte: 73, Char: 's'
Byte: 65, Char: 'e'
Byte: 7d, Char: '}'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 00, Char: '\0'
Byte: 7b, Char: '{'
Byte: 73, Char: 's'
Byte: 68, Char: 'h'
Byte: 6f, Char: 'o'
Byte: 75, Char: 'u'
Byte: 6c, Char: 'l'
Byte: 64, Char: 'd'
Byte: 5f, Char: '_'
Byte: 66, Char: 'f'
Byte: 61, Char: 'a'
Byte: 69, Char: 'i'
Byte: 6c, Char: 'l'
Byte: 5f, Char: '_'
Byte: 61, Char: 'a'
Byte: 74, Char: 't'
Byte: 5f, Char: '_'
Byte: 38, Char: '8'
Byte: 2c, Char: ','
Byte: 66, Char: 'f'
Byte: 61, Char: 'a'
Byte: 6c, Char: 'l'
Byte: 73, Char: 's'
Byte: 65, Char: 'e'
Byte: 7d, Char: '}'
ToSql is expected to return the value encoded in Postgres's binary protocol, not the text protocol. https://github.com/sfackler/rust-postgres-array can help make that easier to work with.
Made it work at the other repo you said @sfackler thanks one more time in here..
For information of others, if get in this trouble. https://github.com/sfackler/rust-postgres-array/issues/14
I have a function like:
I tried a lot of different things to make the rust call it and it works. The final workaround was to create a wrapper like:
Any solution to make it able to call directly? Some of things i tried, first i created a own class extending HashMap
Then i implemented ToSql in it, trying some options, the first was:
This it was saying the max lenght (293838793) of array was higher than the (6) allowed. Then i tried, using this repo as base, to implement a custom array writer
something like this, but it was either saying that im trying to send array of type that was not expected, or it sends but getting all null, because it when send it was wrapping my data into quotes, so could never make it work.
any help on this so i get rid of the workaround function? thanks