From 3e230ba7313cffe1aa245f913c30c0105509f822 Mon Sep 17 00:00:00 2001 From: WGH Date: Mon, 28 Mar 2022 05:03:18 +0300 Subject: [PATCH] Split encode_binary and decode_binary in typed_array.go.erb Again, RECORD, for example, has binary decoding, but no binary encoding. --- typed_array.go.erb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/typed_array.go.erb b/typed_array.go.erb index 31debcd8..e8433c04 100644 --- a/typed_array.go.erb +++ b/typed_array.go.erb @@ -7,6 +7,9 @@ text_format ||= "true" text_null ||= "NULL" + + encode_binary ||= binary_format + decode_binary ||= binary_format %> package pgtype @@ -326,7 +329,7 @@ func (dst *<%= pgtype_array_type %>) DecodeText(ci *ConnInfo, src []byte) error } <% end %> -<% if binary_format == "true" %> +<% if decode_binary == "true" %> func (dst *<%= pgtype_array_type %>) DecodeBinary(ci *ConnInfo, src []byte) error { if src == nil { *dst = <%= pgtype_array_type %>{Status: Null} @@ -429,7 +432,7 @@ func (src <%= pgtype_array_type %>) EncodeText(ci *ConnInfo, buf []byte) ([]byte } <% end %> -<% if binary_format == "true" %> +<% if encode_binary == "true" %> func (src <%= pgtype_array_type %>) EncodeBinary(ci *ConnInfo, buf []byte) ([]byte, error) { switch src.Status { case Null: