Skip to content

Commit 9c066f5

Browse files
committed
chore(client): rename number methods
1 parent 35ad89b commit 9c066f5

File tree

4 files changed

+26
-24
lines changed

4 files changed

+26
-24
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ func main() {
3939
err = sender.
4040
Table("trades").
4141
Symbol("name", "test_ilp1").
42-
FloatColumn("value", 12.4).
42+
Float64Column("value", 12.4).
4343
AtNow(ctx)
4444
if err != nil {
4545
log.Fatal(err)
4646
}
4747
err = sender.
4848
Table("trades").
4949
Symbol("name", "test_ilp2").
50-
FloatColumn("value", 11.4).
50+
Float64Column("value", 11.4).
5151
At(ctx, time.Now().UnixNano())
5252
if err != nil {
5353
log.Fatal(err)

sender.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ func (s *LineSender) Table(name string) *LineSender {
248248
return s
249249
}
250250

251-
// Symbol adds a symbol column (tag) value to the ILP message. Should be
252-
// called before any Column method.
251+
// Symbol adds a symbol column value to the ILP message. Should be called
252+
// before any Column method.
253253
//
254254
// Symbol name cannot contain any of the following characters:
255255
// '\n', '\r', '.', '?', ',', ':', '\\', '/', '\\0', ')', '(', '+', '*',
@@ -282,12 +282,13 @@ func (s *LineSender) Symbol(name, val string) *LineSender {
282282
return s
283283
}
284284

285-
// IntColumn adds a 64-bit integer column value to the ILP message.
285+
// Int64Column adds a 64-bit integer (long) column value to the ILP
286+
// message.
286287
//
287288
// Column name cannot contain any of the following characters:
288289
// '\n', '\r', '.', '?', ',', ':', '\\', '/', '\\0', ')', '(', '+', '*',
289290
// '~', '%%', '-'.
290-
func (s *LineSender) IntColumn(name string, val int64) *LineSender {
291+
func (s *LineSender) Int64Column(name string, val int64) *LineSender {
291292
if !s.prepareForField(name) {
292293
return s
293294
}
@@ -302,12 +303,13 @@ func (s *LineSender) IntColumn(name string, val int64) *LineSender {
302303
return s
303304
}
304305

305-
// FloatColumn adds a 64-bit float column value to the ILP message.
306+
// Float64Column adds a 64-bit float (double) column value to the ILP
307+
// message.
306308
//
307309
// Column name cannot contain any of the following characters:
308310
// '\n', '\r', '.', '?', ',', ':', '\\', '/', '\\0', ')', '(', '+', '*',
309311
// '~', '%%', '-'.
310-
func (s *LineSender) FloatColumn(name string, val float64) *LineSender {
312+
func (s *LineSender) Float64Column(name string, val float64) *LineSender {
311313
if !s.prepareForField(name) {
312314
return s
313315
}

sender_integration_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ func TestAllColumnTypes(t *testing.T) {
232232
err = sender.
233233
Table(testTable).
234234
Symbol("sym_col", "test_ilp1").
235-
FloatColumn("double_col", 12.2).
236-
IntColumn("long_col", 12).
235+
Float64Column("double_col", 12.2).
236+
Int64Column("long_col", 12).
237237
StringColumn("str_col", "foobar").
238238
BoolColumn("bool_col", true).
239239
At(ctx, 1000)
@@ -242,8 +242,8 @@ func TestAllColumnTypes(t *testing.T) {
242242
err = sender.
243243
Table(testTable).
244244
Symbol("sym_col", "test_ilp2").
245-
FloatColumn("double_col", 11.2).
246-
IntColumn("long_col", 11).
245+
Float64Column("double_col", 11.2).
246+
Int64Column("long_col", 11).
247247
StringColumn("str_col", "barbaz").
248248
BoolColumn("bool_col", false).
249249
At(ctx, 2000)
@@ -298,7 +298,7 @@ func TestWriteInBatches(t *testing.T) {
298298
for j := 0; j < nBatch; j++ {
299299
err = sender.
300300
Table(testTable).
301-
IntColumn("long_col", int64(j)).
301+
Int64Column("long_col", int64(j)).
302302
At(ctx, 1000*int64(i*nBatch+j))
303303
assert.NoError(t, err)
304304
}

sender_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ func TestValidWrites(t *testing.T) {
5757
{
5858
"multiple rows",
5959
func(s *qdb.LineSender) error {
60-
err := s.Table(testTable).StringColumn("str_col", "foo").IntColumn("long_col", 42).AtNow(ctx)
60+
err := s.Table(testTable).StringColumn("str_col", "foo").Int64Column("long_col", 42).AtNow(ctx)
6161
if err != nil {
6262
return err
6363
}
64-
err = s.Table(testTable).StringColumn("str_col", "bar").IntColumn("long_col", -42).At(ctx, 42)
64+
err = s.Table(testTable).StringColumn("str_col", "bar").Int64Column("long_col", -42).At(ctx, 42)
6565
if err != nil {
6666
return err
6767
}
@@ -75,7 +75,7 @@ func TestValidWrites(t *testing.T) {
7575
{
7676
"escaped chars in table name",
7777
func(s *qdb.LineSender) error {
78-
return s.Table("test 1\"2=3").IntColumn("a_col", 42).AtNow(ctx)
78+
return s.Table("test 1\"2=3").Int64Column("a_col", 42).AtNow(ctx)
7979
},
8080
[]string{
8181
"test\\ 1\\\"2\\=3 a_col=42i\n",
@@ -159,7 +159,7 @@ func TestIntSerialization(t *testing.T) {
159159
sender, err := qdb.NewLineSender(ctx, qdb.WithAddress(srv.addr))
160160
assert.NoError(t, err)
161161

162-
err = sender.Table(testTable).IntColumn("a_col", tc.val).AtNow(ctx)
162+
err = sender.Table(testTable).Int64Column("a_col", tc.val).AtNow(ctx)
163163
assert.NoError(t, err)
164164

165165
err = sender.Flush(ctx)
@@ -202,7 +202,7 @@ func TestFloatSerialization(t *testing.T) {
202202
sender, err := qdb.NewLineSender(ctx, qdb.WithAddress(srv.addr))
203203
assert.NoError(t, err)
204204

205-
err = sender.Table(testTable).FloatColumn("a_col", tc.val).AtNow(ctx)
205+
err = sender.Table(testTable).Float64Column("a_col", tc.val).AtNow(ctx)
206206
assert.NoError(t, err)
207207

208208
err = sender.Flush(ctx)
@@ -523,13 +523,13 @@ func TestErrorOnMissingTableCall(t *testing.T) {
523523
{
524524
"long column",
525525
func(s *qdb.LineSender) error {
526-
return s.IntColumn("int", 42).AtNow(ctx)
526+
return s.Int64Column("int", 42).AtNow(ctx)
527527
},
528528
},
529529
{
530530
"double column",
531531
func(s *qdb.LineSender) error {
532-
return s.FloatColumn("float", 4.2).AtNow(ctx)
532+
return s.Float64Column("float", 4.2).AtNow(ctx)
533533
},
534534
},
535535
}
@@ -592,13 +592,13 @@ func TestErrorOnSymbolCallAfterColumn(t *testing.T) {
592592
{
593593
"integer column",
594594
func(s *qdb.LineSender) error {
595-
return s.Table("awesome_table").IntColumn("int", 42).Symbol("sym", "abc").AtNow(ctx)
595+
return s.Table("awesome_table").Int64Column("int", 42).Symbol("sym", "abc").AtNow(ctx)
596596
},
597597
},
598598
{
599599
"float column",
600600
func(s *qdb.LineSender) error {
601-
return s.Table("awesome_table").FloatColumn("float", 4.2).Symbol("sym", "abc").AtNow(ctx)
601+
return s.Table("awesome_table").Float64Column("float", 4.2).Symbol("sym", "abc").AtNow(ctx)
602602
},
603603
},
604604
}
@@ -723,8 +723,8 @@ func BenchmarkLineSender(b *testing.B) {
723723
sender.
724724
Table(testTable).
725725
Symbol("sym_col", "test_ilp1").
726-
FloatColumn("double_col", float64(i)+0.42).
727-
IntColumn("long_col", int64(i)).
726+
Float64Column("double_col", float64(i)+0.42).
727+
Int64Column("long_col", int64(i)).
728728
StringColumn("str_col", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua").
729729
BoolColumn("bool_col", true).
730730
At(ctx, int64(1000*i))

0 commit comments

Comments
 (0)