mirror of https://github.com/jackc/pgx.git
parent
a80ef6d35f
commit
36bdbd7cb1
11
values.go
11
values.go
|
@ -3009,7 +3009,16 @@ func encodeAclItemSlice(w *WriteBuf, oid Oid, value []AclItem) error {
|
||||||
|
|
||||||
// XXX: decodeAclItemArray; using text encoding, not binary
|
// XXX: decodeAclItemArray; using text encoding, not binary
|
||||||
func decodeAclItemArray(vr *ValueReader) []AclItem {
|
func decodeAclItemArray(vr *ValueReader) []AclItem {
|
||||||
return []AclItem{"=r/postgres"}
|
if vr.Len() == -1 {
|
||||||
|
vr.Fatal(ProtocolError("Cannot decode null into []AclItem"))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
str := vr.ReadString(vr.Len())
|
||||||
|
// remove the '{' at the front and the '}' at the end
|
||||||
|
str = str[1 : len(str)-1]
|
||||||
|
return []AclItem{AclItem(str)}
|
||||||
|
// return []AclItem{"=r/postgres"}
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeStringSlice(w *WriteBuf, oid Oid, slice []string) error {
|
func encodeStringSlice(w *WriteBuf, oid Oid, slice []string) error {
|
||||||
|
|
|
@ -661,7 +661,7 @@ func TestAclArrayDecoding(t *testing.T) {
|
||||||
&[]pgx.AclItem{},
|
&[]pgx.AclItem{},
|
||||||
func(t *testing.T, query, scan interface{}) {
|
func(t *testing.T, query, scan interface{}) {
|
||||||
if !reflect.DeepEqual(query, *(scan.(*[]pgx.AclItem))) {
|
if !reflect.DeepEqual(query, *(scan.(*[]pgx.AclItem))) {
|
||||||
t.Errorf("failed to encode aclitem[]")
|
t.Errorf("failed to encode aclitem[]\n EXPECTED: %v\n ACTUAL: %v", query, *(scan.(*[]pgx.AclItem)))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue