forked from jackc/pgtype
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bpchar_array_test.go
55 lines (52 loc) · 1.63 KB
/
bpchar_array_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package pgtype_test
import (
"testing"
"github.com/jackc/pgtype"
"github.com/jackc/pgtype/testutil"
)
func TestBPCharArrayTranscode(t *testing.T) {
testutil.TestSuccessfulTranscode(t, "char(8)[]", []interface{}{
&pgtype.BPCharArray{
Elements: nil,
Dimensions: nil,
Status: pgtype.Present,
},
&pgtype.BPCharArray{
Elements: []pgtype.BPChar{
pgtype.BPChar{String: "foo ", Status: pgtype.Present},
pgtype.BPChar{Status: pgtype.Null},
},
Dimensions: []pgtype.ArrayDimension{{Length: 2, LowerBound: 1}},
Status: pgtype.Present,
},
&pgtype.BPCharArray{Status: pgtype.Null},
&pgtype.BPCharArray{
Elements: []pgtype.BPChar{
pgtype.BPChar{String: "bar ", Status: pgtype.Present},
pgtype.BPChar{String: "NuLL ", Status: pgtype.Present},
pgtype.BPChar{String: `wow"quz\`, Status: pgtype.Present},
pgtype.BPChar{String: "1 ", Status: pgtype.Present},
pgtype.BPChar{String: "1 ", Status: pgtype.Present},
pgtype.BPChar{String: "null ", Status: pgtype.Present},
},
Dimensions: []pgtype.ArrayDimension{
{Length: 3, LowerBound: 1},
{Length: 2, LowerBound: 1},
},
Status: pgtype.Present,
},
&pgtype.BPCharArray{
Elements: []pgtype.BPChar{
pgtype.BPChar{String: " bar ", Status: pgtype.Present},
pgtype.BPChar{String: " baz ", Status: pgtype.Present},
pgtype.BPChar{String: " quz ", Status: pgtype.Present},
pgtype.BPChar{String: "foo ", Status: pgtype.Present},
},
Dimensions: []pgtype.ArrayDimension{
{Length: 2, LowerBound: 4},
{Length: 2, LowerBound: 2},
},
Status: pgtype.Present,
},
})
}