mirror of
https://github.com/jackc/pgx.git
synced 2025-05-31 11:42:24 +00:00
37 lines
812 B
Go
37 lines
812 B
Go
package pgtype_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/jackc/pgtype"
|
|
"github.com/jackc/pgtype/testutil"
|
|
)
|
|
|
|
func TestJSONBArrayTranscode(t *testing.T) {
|
|
testutil.TestSuccessfulTranscode(t, "jsonb[]", []interface{}{
|
|
&pgtype.JSONBArray{
|
|
Elements: nil,
|
|
Dimensions: nil,
|
|
Valid: true,
|
|
},
|
|
&pgtype.JSONBArray{
|
|
Elements: []pgtype.JSONB{
|
|
{Bytes: []byte(`"foo"`), Valid: true},
|
|
{},
|
|
},
|
|
Dimensions: []pgtype.ArrayDimension{{Length: 2, LowerBound: 1}},
|
|
Valid: true,
|
|
},
|
|
&pgtype.JSONBArray{},
|
|
&pgtype.JSONBArray{
|
|
Elements: []pgtype.JSONB{
|
|
{Bytes: []byte(`"foo"`), Valid: true},
|
|
{Bytes: []byte("null"), Valid: true},
|
|
{Bytes: []byte("42"), Valid: true},
|
|
},
|
|
Dimensions: []pgtype.ArrayDimension{{Length: 3, LowerBound: 1}},
|
|
Valid: true,
|
|
},
|
|
})
|
|
}
|