Moves sql outside of struct
This commit is contained in:
@@ -3018,7 +3018,6 @@ func decodeAclItemArray(vr *ValueReader) []AclItem {
|
|||||||
// remove the '{' at the front and the '}' at the end
|
// remove the '{' at the front and the '}' at the end
|
||||||
str = str[1 : len(str)-1]
|
str = str[1 : len(str)-1]
|
||||||
return []AclItem{AclItem(str)}
|
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 {
|
||||||
|
|||||||
+3
-3
@@ -649,14 +649,14 @@ func TestAclArrayDecoding(t *testing.T) {
|
|||||||
|
|
||||||
conn := mustConnect(t, *defaultConnConfig)
|
conn := mustConnect(t, *defaultConnConfig)
|
||||||
defer closeConn(t, conn)
|
defer closeConn(t, conn)
|
||||||
|
|
||||||
|
sql := "select $1::aclitem[]"
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
sql string
|
|
||||||
query interface{}
|
query interface{}
|
||||||
scan interface{}
|
scan interface{}
|
||||||
assert func(*testing.T, interface{}, interface{})
|
assert func(*testing.T, interface{}, interface{})
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
"select $1::aclitem[]",
|
|
||||||
[]pgx.AclItem{"=r/postgres"},
|
[]pgx.AclItem{"=r/postgres"},
|
||||||
&[]pgx.AclItem{},
|
&[]pgx.AclItem{},
|
||||||
func(t *testing.T, query, scan interface{}) {
|
func(t *testing.T, query, scan interface{}) {
|
||||||
@@ -667,7 +667,7 @@ func TestAclArrayDecoding(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
for i, tt := range tests {
|
for i, tt := range tests {
|
||||||
err := conn.QueryRow(tt.sql, tt.query).Scan(tt.scan)
|
err := conn.QueryRow(sql, tt.query).Scan(tt.scan)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf(`%d. error reading array: %v`, i, err)
|
t.Errorf(`%d. error reading array: %v`, i, err)
|
||||||
if pgerr, ok := err.(pgx.PgError); ok {
|
if pgerr, ok := err.(pgx.PgError); ok {
|
||||||
|
|||||||
Reference in New Issue
Block a user