mirror of https://github.com/jackc/pgx.git
Split encode_binary and decode_binary in typed_array.go.erb
Again, RECORD, for example, has binary decoding, but no binary encoding.non-blocking
parent
5db1de5fc1
commit
3e230ba731
|
@ -7,6 +7,9 @@
|
||||||
text_format ||= "true"
|
text_format ||= "true"
|
||||||
|
|
||||||
text_null ||= "NULL"
|
text_null ||= "NULL"
|
||||||
|
|
||||||
|
encode_binary ||= binary_format
|
||||||
|
decode_binary ||= binary_format
|
||||||
%>
|
%>
|
||||||
|
|
||||||
package pgtype
|
package pgtype
|
||||||
|
@ -326,7 +329,7 @@ func (dst *<%= pgtype_array_type %>) DecodeText(ci *ConnInfo, src []byte) error
|
||||||
}
|
}
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if binary_format == "true" %>
|
<% if decode_binary == "true" %>
|
||||||
func (dst *<%= pgtype_array_type %>) DecodeBinary(ci *ConnInfo, src []byte) error {
|
func (dst *<%= pgtype_array_type %>) DecodeBinary(ci *ConnInfo, src []byte) error {
|
||||||
if src == nil {
|
if src == nil {
|
||||||
*dst = <%= pgtype_array_type %>{Status: Null}
|
*dst = <%= pgtype_array_type %>{Status: Null}
|
||||||
|
@ -429,7 +432,7 @@ func (src <%= pgtype_array_type %>) EncodeText(ci *ConnInfo, buf []byte) ([]byte
|
||||||
}
|
}
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if binary_format == "true" %>
|
<% if encode_binary == "true" %>
|
||||||
func (src <%= pgtype_array_type %>) EncodeBinary(ci *ConnInfo, buf []byte) ([]byte, error) {
|
func (src <%= pgtype_array_type %>) EncodeBinary(ci *ConnInfo, buf []byte) ([]byte, error) {
|
||||||
switch src.Status {
|
switch src.Status {
|
||||||
case Null:
|
case Null:
|
||||||
|
|
Loading…
Reference in New Issue