@@ -21,50 +21,50 @@ func TestDocumentBuilder(t *testing.T) {
21
21
22
22
testCases := []struct {
23
23
name string
24
- fn interface {}
25
- params []interface {}
24
+ fn any
25
+ params []any
26
26
expected []byte
27
27
}{
28
28
{
29
29
"AppendInt32" ,
30
30
NewDocumentBuilder ().AppendInt32 ,
31
- []interface {} {"foobar" , int32 (256 )},
31
+ []any {"foobar" , int32 (256 )},
32
32
BuildDocumentFromElements (nil , AppendInt32Element (nil , "foobar" , 256 )),
33
33
},
34
34
{
35
35
"AppendDouble" ,
36
36
NewDocumentBuilder ().AppendDouble ,
37
- []interface {} {"foobar" , float64 (3.14159 )},
37
+ []any {"foobar" , float64 (3.14159 )},
38
38
BuildDocumentFromElements (nil , AppendDoubleElement (nil , "foobar" , float64 (3.14159 ))),
39
39
},
40
40
{
41
41
"AppendString" ,
42
42
NewDocumentBuilder ().AppendString ,
43
- []interface {} {"foobar" , "x" },
43
+ []any {"foobar" , "x" },
44
44
BuildDocumentFromElements (nil , AppendStringElement (nil , "foobar" , "x" )),
45
45
},
46
46
{
47
47
"AppendDocument" ,
48
48
NewDocumentBuilder ().AppendDocument ,
49
- []interface {} {"foobar" , []byte {0x05 , 0x00 , 0x00 , 0x00 , 0x00 }},
49
+ []any {"foobar" , []byte {0x05 , 0x00 , 0x00 , 0x00 , 0x00 }},
50
50
BuildDocumentFromElements (nil , AppendDocumentElement (nil , "foobar" , []byte {0x05 , 0x00 , 0x00 , 0x00 , 0x00 })),
51
51
},
52
52
{
53
53
"AppendArray" ,
54
54
NewDocumentBuilder ().AppendArray ,
55
- []interface {} {"foobar" , []byte {0x05 , 0x00 , 0x00 , 0x00 , 0x00 }},
55
+ []any {"foobar" , []byte {0x05 , 0x00 , 0x00 , 0x00 , 0x00 }},
56
56
BuildDocumentFromElements (nil , AppendArrayElement (nil , "foobar" , []byte {0x05 , 0x00 , 0x00 , 0x00 , 0x00 })),
57
57
},
58
58
{
59
59
"AppendBinary" ,
60
60
NewDocumentBuilder ().AppendBinary ,
61
- []interface {} {"foobar" , byte (0x02 ), []byte {0x01 , 0x02 , 0x03 }},
61
+ []any {"foobar" , byte (0x02 ), []byte {0x01 , 0x02 , 0x03 }},
62
62
BuildDocumentFromElements (nil , AppendBinaryElement (nil , "foobar" , byte (0x02 ), []byte {0x01 , 0x02 , 0x03 })),
63
63
},
64
64
{
65
65
"AppendObjectID" ,
66
66
NewDocumentBuilder ().AppendObjectID ,
67
- []interface {} {
67
+ []any {
68
68
"foobar" ,
69
69
[12 ]byte {0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x08 , 0x09 , 0x0A , 0x0B , 0x0C },
70
70
},
@@ -74,87 +74,87 @@ func TestDocumentBuilder(t *testing.T) {
74
74
{
75
75
"AppendBoolean" ,
76
76
NewDocumentBuilder ().AppendBoolean ,
77
- []interface {} {"foobar" , true },
77
+ []any {"foobar" , true },
78
78
BuildDocumentFromElements (nil , AppendBooleanElement (nil , "foobar" , true )),
79
79
},
80
80
{
81
81
"AppendDateTime" ,
82
82
NewDocumentBuilder ().AppendDateTime ,
83
- []interface {} {"foobar" , int64 (256 )},
83
+ []any {"foobar" , int64 (256 )},
84
84
BuildDocumentFromElements (nil , AppendDateTimeElement (nil , "foobar" , int64 (256 ))),
85
85
},
86
86
{
87
87
"AppendNull" ,
88
88
NewDocumentBuilder ().AppendNull ,
89
- []interface {} {"foobar" },
89
+ []any {"foobar" },
90
90
BuildDocumentFromElements (nil , AppendNullElement (nil , "foobar" )),
91
91
},
92
92
{
93
93
"AppendRegex" ,
94
94
NewDocumentBuilder ().AppendRegex ,
95
- []interface {} {"foobar" , "bar" , "baz" },
95
+ []any {"foobar" , "bar" , "baz" },
96
96
BuildDocumentFromElements (nil , AppendRegexElement (nil , "foobar" , "bar" , "baz" )),
97
97
},
98
98
{
99
99
"AppendJavaScript" ,
100
100
NewDocumentBuilder ().AppendJavaScript ,
101
- []interface {} {"foobar" , "barbaz" },
101
+ []any {"foobar" , "barbaz" },
102
102
BuildDocumentFromElements (nil , AppendJavaScriptElement (nil , "foobar" , "barbaz" )),
103
103
},
104
104
{
105
105
"AppendCodeWithScope" ,
106
106
NewDocumentBuilder ().AppendCodeWithScope ,
107
- []interface {} {"foobar" , "barbaz" , Document ([]byte {0x05 , 0x00 , 0x00 , 0x00 , 0x00 })},
107
+ []any {"foobar" , "barbaz" , Document ([]byte {0x05 , 0x00 , 0x00 , 0x00 , 0x00 })},
108
108
BuildDocumentFromElements (nil , AppendCodeWithScopeElement (nil , "foobar" , "barbaz" , Document ([]byte {0x05 , 0x00 , 0x00 , 0x00 , 0x00 }))),
109
109
},
110
110
{
111
111
"AppendTimestamp" ,
112
112
NewDocumentBuilder ().AppendTimestamp ,
113
- []interface {} {"foobar" , uint32 (65536 ), uint32 (256 )},
113
+ []any {"foobar" , uint32 (65536 ), uint32 (256 )},
114
114
BuildDocumentFromElements (nil , AppendTimestampElement (nil , "foobar" , uint32 (65536 ), uint32 (256 ))),
115
115
},
116
116
{
117
117
"AppendInt64" ,
118
118
NewDocumentBuilder ().AppendInt64 ,
119
- []interface {} {"foobar" , int64 (4294967296 )},
119
+ []any {"foobar" , int64 (4294967296 )},
120
120
BuildDocumentFromElements (nil , AppendInt64Element (nil , "foobar" , int64 (4294967296 ))),
121
121
},
122
122
{
123
123
"AppendDecimal128" ,
124
124
NewDocumentBuilder ().AppendDecimal128 ,
125
- []interface {} {"foobar" , uint64 (4294967296 ), uint64 (65536 )},
125
+ []any {"foobar" , uint64 (4294967296 ), uint64 (65536 )},
126
126
BuildDocumentFromElements (nil , AppendDecimal128Element (nil , "foobar" , 4294967296 , 65536 )),
127
127
},
128
128
{
129
129
"AppendMaxKey" ,
130
130
NewDocumentBuilder ().AppendMaxKey ,
131
- []interface {} {"foobar" },
131
+ []any {"foobar" },
132
132
BuildDocumentFromElements (nil , AppendMaxKeyElement (nil , "foobar" )),
133
133
},
134
134
{
135
135
"AppendMinKey" ,
136
136
NewDocumentBuilder ().AppendMinKey ,
137
- []interface {} {"foobar" },
137
+ []any {"foobar" },
138
138
BuildDocumentFromElements (nil , AppendMinKeyElement (nil , "foobar" )),
139
139
},
140
140
{
141
141
"AppendSymbol" ,
142
142
NewDocumentBuilder ().AppendSymbol ,
143
- []interface {} {"foobar" , "barbaz" },
143
+ []any {"foobar" , "barbaz" },
144
144
BuildDocumentFromElements (nil , AppendSymbolElement (nil , "foobar" , "barbaz" )),
145
145
},
146
146
{
147
147
"AppendDBPointer" ,
148
148
NewDocumentBuilder ().AppendDBPointer ,
149
- []interface {} {"foobar" , "barbaz" ,
149
+ []any {"foobar" , "barbaz" ,
150
150
[12 ]byte {0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x08 , 0x09 , 0x0A , 0x0B , 0x0C }},
151
151
BuildDocumentFromElements (nil , AppendDBPointerElement (nil , "foobar" , "barbaz" ,
152
152
[12 ]byte {0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x08 , 0x09 , 0x0A , 0x0B , 0x0C })),
153
153
},
154
154
{
155
155
"AppendUndefined" ,
156
156
NewDocumentBuilder ().AppendUndefined ,
157
- []interface {} {"foobar" },
157
+ []any {"foobar" },
158
158
BuildDocumentFromElements (nil , AppendUndefinedElement (nil , "foobar" )),
159
159
},
160
160
}
0 commit comments