2
0

Automatically register Array and FlatArray

This commit is contained in:
Jack Christensen
2022-04-16 14:04:25 -05:00
parent fccaebc93d
commit a01a9ee6df
2 changed files with 94 additions and 74 deletions
+12 -1
View File
@@ -374,7 +374,7 @@ func TestConnSimpleSlicePassThrough(t *testing.T) {
})
}
func TestConnQueryScanArray(t *testing.T) {
func TestConnQueryScanGoArray(t *testing.T) {
testWithAllQueryExecModes(t, func(t *testing.T, db *sql.DB) {
m := pgtype.NewMap()
@@ -385,6 +385,17 @@ func TestConnQueryScanArray(t *testing.T) {
})
}
func TestConnQueryScanArray(t *testing.T) {
testWithAllQueryExecModes(t, func(t *testing.T, db *sql.DB) {
m := pgtype.NewMap()
var a pgtype.Array[int64]
err := db.QueryRow("select '{1,2,3}'::bigint[]").Scan(m.SQLScanner(&a))
require.NoError(t, err)
assert.Equal(t, pgtype.Array[int64]{Elements: []int64{1, 2, 3}, Dims: []pgtype.ArrayDimension{{Length: 3, LowerBound: 1}}, Valid: true}, a)
})
}
func TestConnQueryScanRange(t *testing.T) {
testWithAllQueryExecModes(t, func(t *testing.T, db *sql.DB) {
m := pgtype.NewMap()