@@ -55,11 +55,11 @@ func TestValidWrites(t *testing.T) {
55
55
{
56
56
"single string column" ,
57
57
func (s * qdb.LineSender ) error {
58
- err := s .Table (testTable ).StringField ("a_col" , "foo" ).AtNow (ctx )
58
+ err := s .Table (testTable ).StringColumn ("a_col" , "foo" ).AtNow (ctx )
59
59
if err != nil {
60
60
return err
61
61
}
62
- err = s .Table (testTable ).StringField ("a_col" , "bar" ).At (ctx , 42 )
62
+ err = s .Table (testTable ).StringColumn ("a_col" , "bar" ).At (ctx , 42 )
63
63
if err != nil {
64
64
return err
65
65
}
@@ -73,7 +73,7 @@ func TestValidWrites(t *testing.T) {
73
73
{
74
74
"escaped chars in table name" ,
75
75
func (s * qdb.LineSender ) error {
76
- return s .Table ("test 1,2\" 3\\ 4" ).IntField ("a_col" , 42 ).AtNow (ctx )
76
+ return s .Table ("test 1,2\" 3\\ 4" ).IntColumn ("a_col" , 42 ).AtNow (ctx )
77
77
},
78
78
[]string {
79
79
"test\\ 1\\ ,2\\ \" 3\\ \\ 4 a_col=42i\n " ,
@@ -82,7 +82,7 @@ func TestValidWrites(t *testing.T) {
82
82
{
83
83
"escaped chars in column name" ,
84
84
func (s * qdb.LineSender ) error {
85
- return s .Table ("test_table" ).FloatField ("name 1,2\" 3\\ 4" , 42 ).AtNow (ctx )
85
+ return s .Table ("test_table" ).FloatColumn ("name 1,2\" 3\\ 4" , 42 ).AtNow (ctx )
86
86
},
87
87
[]string {
88
88
"test_table name\\ 1\\ ,2\\ \" 3\\ \\ 4=42.000000\n " ,
@@ -155,27 +155,27 @@ func TestErrorOnMissingTableCall(t *testing.T) {
155
155
},
156
156
},
157
157
{
158
- "string field " ,
158
+ "string column " ,
159
159
func (s * qdb.LineSender ) error {
160
- return s .StringField ("str" , "abc" ).AtNow (ctx )
160
+ return s .StringColumn ("str" , "abc" ).AtNow (ctx )
161
161
},
162
162
},
163
163
{
164
- "boolean field " ,
164
+ "boolean column " ,
165
165
func (s * qdb.LineSender ) error {
166
- return s .BoolField ("bool" , true ).AtNow (ctx )
166
+ return s .BoolColumn ("bool" , true ).AtNow (ctx )
167
167
},
168
168
},
169
169
{
170
- "integer field " ,
170
+ "long column " ,
171
171
func (s * qdb.LineSender ) error {
172
- return s .IntField ("int" , 42 ).AtNow (ctx )
172
+ return s .IntColumn ("int" , 42 ).AtNow (ctx )
173
173
},
174
174
},
175
175
{
176
- "float field " ,
176
+ "double column " ,
177
177
func (s * qdb.LineSender ) error {
178
- return s .FloatField ("float" , 4.2 ).AtNow (ctx )
178
+ return s .FloatColumn ("float" , 4.2 ).AtNow (ctx )
179
179
},
180
180
},
181
181
}
@@ -216,35 +216,35 @@ func TestErrorOnMultipleTableCalls(t *testing.T) {
216
216
assert .Empty (t , sender .Messages ())
217
217
}
218
218
219
- func TestErrorOnSymbolCallAfterField (t * testing.T ) {
219
+ func TestErrorOnSymbolCallAfterColumn (t * testing.T ) {
220
220
ctx := context .Background ()
221
221
222
222
testCases := []struct {
223
223
name string
224
224
writerFn writer
225
225
}{
226
226
{
227
- "string field " ,
227
+ "string column " ,
228
228
func (s * qdb.LineSender ) error {
229
- return s .Table ("awesome_table" ).StringField ("str" , "abc" ).Symbol ("sym" , "abc" ).AtNow (ctx )
229
+ return s .Table ("awesome_table" ).StringColumn ("str" , "abc" ).Symbol ("sym" , "abc" ).AtNow (ctx )
230
230
},
231
231
},
232
232
{
233
- "boolean field " ,
233
+ "boolean column " ,
234
234
func (s * qdb.LineSender ) error {
235
- return s .Table ("awesome_table" ).BoolField ("bool" , true ).Symbol ("sym" , "abc" ).AtNow (ctx )
235
+ return s .Table ("awesome_table" ).BoolColumn ("bool" , true ).Symbol ("sym" , "abc" ).AtNow (ctx )
236
236
},
237
237
},
238
238
{
239
- "integer field " ,
239
+ "integer column " ,
240
240
func (s * qdb.LineSender ) error {
241
- return s .Table ("awesome_table" ).IntField ("int" , 42 ).Symbol ("sym" , "abc" ).AtNow (ctx )
241
+ return s .Table ("awesome_table" ).IntColumn ("int" , 42 ).Symbol ("sym" , "abc" ).AtNow (ctx )
242
242
},
243
243
},
244
244
{
245
- "float field " ,
245
+ "float column " ,
246
246
func (s * qdb.LineSender ) error {
247
- return s .Table ("awesome_table" ).FloatField ("float" , 4.2 ).Symbol ("sym" , "abc" ).AtNow (ctx )
247
+ return s .Table ("awesome_table" ).FloatColumn ("float" , 4.2 ).Symbol ("sym" , "abc" ).AtNow (ctx )
248
248
},
249
249
},
250
250
}
@@ -259,7 +259,7 @@ func TestErrorOnSymbolCallAfterField(t *testing.T) {
259
259
260
260
err = tc .writerFn (sender )
261
261
262
- assert .EqualError (t , err , "symbol has to be written before any field " )
262
+ assert .EqualError (t , err , "symbols have to be written before any other column " )
263
263
assert .Empty (t , sender .Messages ())
264
264
265
265
sender .Close ()
@@ -280,10 +280,10 @@ func TestInvalidMessageGetsDiscarded(t *testing.T) {
280
280
defer sender .Close ()
281
281
282
282
// Write a valid message.
283
- err = sender .Table (testTable ).StringField ("foo" , "bar" ).AtNow (ctx )
283
+ err = sender .Table (testTable ).StringColumn ("foo" , "bar" ).AtNow (ctx )
284
284
assert .NoError (t , err )
285
285
// Then write perform an incorrect chain of calls.
286
- err = sender .Table (testTable ).StringField ("foo" , "bar" ).Symbol ("sym" , "42" ).AtNow (ctx )
286
+ err = sender .Table (testTable ).StringColumn ("foo" , "bar" ).Symbol ("sym" , "42" ).AtNow (ctx )
287
287
assert .Error (t , err )
288
288
289
289
// The second message should be discarded.
@@ -311,15 +311,15 @@ func TestErrorOnCancelledContext(t *testing.T) {
311
311
defer sender .Close ()
312
312
313
313
// The context is not cancelled yet, so Flush should succeed.
314
- err = sender .Table (testTable ).StringField ("foo" , "bar" ).AtNow (ctx )
314
+ err = sender .Table (testTable ).StringColumn ("foo" , "bar" ).AtNow (ctx )
315
315
assert .NoError (t , err )
316
316
err = sender .Flush (ctx )
317
317
assert .NoError (t , err )
318
318
319
319
cancel ()
320
320
321
321
// The context is now cancelled, so we expect an error.
322
- err = sender .Table (testTable ).StringField ("bar" , "baz" ).AtNow (ctx )
322
+ err = sender .Table (testTable ).StringColumn ("bar" , "baz" ).AtNow (ctx )
323
323
assert .NoError (t , err )
324
324
err = sender .Flush (ctx )
325
325
assert .Error (t , err )
@@ -339,7 +339,7 @@ func TestErrorOnContextDeadline(t *testing.T) {
339
339
340
340
// Keep writing until we get an error due to the context deadline.
341
341
for i := 0 ; i < 100_000 ; i ++ {
342
- err = sender .Table (testTable ).StringField ("bar" , "baz" ).AtNow (ctx )
342
+ err = sender .Table (testTable ).StringColumn ("bar" , "baz" ).AtNow (ctx )
343
343
if err != nil {
344
344
return
345
345
}
@@ -369,10 +369,10 @@ func BenchmarkLineSender(b *testing.B) {
369
369
sender .
370
370
Table (testTable ).
371
371
Symbol ("sym_col" , "test_ilp1" ).
372
- FloatField ("double_col" , float64 (i )+ 0.42 ).
373
- IntField ("long_col" , int64 (i )).
374
- StringField ("str_col" , "foobar" ).
375
- BoolField ("bool_col" , true ).
372
+ FloatColumn ("double_col" , float64 (i )+ 0.42 ).
373
+ IntColumn ("long_col" , int64 (i )).
374
+ StringColumn ("str_col" , "foobar" ).
375
+ BoolColumn ("bool_col" , true ).
376
376
At (ctx , int64 (1000 * i ))
377
377
}
378
378
sender .Flush (ctx )
0 commit comments