@@ -252,7 +252,7 @@ func (s *LineSender) Close() error {
252
252
// called before any Symbol or Column method.
253
253
//
254
254
// Table name cannot contain any of the following characters:
255
- // '\n', '\r', '?', ',', '' ', '"', '\', '/', ':', ')', '(', '+', '*',
255
+ // '\n', '\r', '?', ',', ” ', '"', '\', '/', ':', ')', '(', '+', '*',
256
256
// '%', '~', starting '.', trailing '.', or a non-printable char.
257
257
func (s * LineSender ) Table (name string ) * LineSender {
258
258
if s .lastErr != nil {
@@ -274,7 +274,7 @@ func (s *LineSender) Table(name string) *LineSender {
274
274
// before any Column method.
275
275
//
276
276
// Symbol name cannot contain any of the following characters:
277
- // '\n', '\r', '?', '.', ',', ''' , '\ "', '\\', '/', ':', ')', '(', '+',
277
+ // '\n', '\r', '?', '.', ',', ”' , '"', '\\', '/', ':', ')', '(', '+',
278
278
// '-', '*' '%%', '~', or a non-printable char.
279
279
func (s * LineSender ) Symbol (name , val string ) * LineSender {
280
280
if s .lastErr != nil {
@@ -306,7 +306,7 @@ func (s *LineSender) Symbol(name, val string) *LineSender {
306
306
// message.
307
307
//
308
308
// Column name cannot contain any of the following characters:
309
- // '\n', '\r', '?', '.', ',', ''' , '\ "', '\\', '/', ':', ')', '(', '+',
309
+ // '\n', '\r', '?', '.', ',', ”' , '"', '\\', '/', ':', ')', '(', '+',
310
310
// '-', '*' '%%', '~', or a non-printable char.
311
311
func (s * LineSender ) Int64Column (name string , val int64 ) * LineSender {
312
312
if ! s .prepareForField (name ) {
@@ -323,11 +323,43 @@ func (s *LineSender) Int64Column(name string, val int64) *LineSender {
323
323
return s
324
324
}
325
325
326
+ // TimestampColumn adds a timestamp column value to the ILP
327
+ // message. Timestamp is Epoch microseconds.
328
+ //
329
+ // Negative timestamp value is not allowed and any attempt to
330
+ // set a negative value will cause an error to be returned on subsequent
331
+ // At() or AtNow() calls.
332
+ //
333
+ // Column name cannot contain any of the following characters:
334
+ // '\n', '\r', '?', '.', ',', ”', '"', '\\', '/', ':', ')', '(', '+',
335
+ // '-', '*' '%%', '~', or a non-printable char.
336
+ func (s * LineSender ) TimestampColumn (name string , ts int64 ) * LineSender {
337
+ if ts < 0 {
338
+ if s .lastErr != nil {
339
+ return s
340
+ }
341
+ s .lastErr = fmt .Errorf ("timestamp cannot be negative: %d" , ts )
342
+ return s
343
+ }
344
+ if ! s .prepareForField (name ) {
345
+ return s
346
+ }
347
+ s .lastErr = s .writeColumnName (name )
348
+ if s .lastErr != nil {
349
+ return s
350
+ }
351
+ s .buf .WriteByte ('=' )
352
+ s .buf .WriteInt (ts )
353
+ s .buf .WriteByte ('t' )
354
+ s .hasFields = true
355
+ return s
356
+ }
357
+
326
358
// Float64Column adds a 64-bit float (double) column value to the ILP
327
359
// message.
328
360
//
329
361
// Column name cannot contain any of the following characters:
330
- // '\n', '\r', '?', '.', ',', ''' , '\ "', '\ \', '/', ':', ')', '(', '+',
362
+ // '\n', '\r', '?', '.', ',', ”' , '"', '\', '/', ':', ')', '(', '+',
331
363
// '-', '*' '%%', '~', or a non-printable char.
332
364
func (s * LineSender ) Float64Column (name string , val float64 ) * LineSender {
333
365
if ! s .prepareForField (name ) {
@@ -346,7 +378,7 @@ func (s *LineSender) Float64Column(name string, val float64) *LineSender {
346
378
// StringColumn adds a string column value to the ILP message.
347
379
//
348
380
// Column name cannot contain any of the following characters:
349
- // '\n', '\r', '?', '.', ',', ''' , '\ "', '\ \', '/', ':', ')', '(', '+',
381
+ // '\n', '\r', '?', '.', ',', ”' , '"', '\', '/', ':', ')', '(', '+',
350
382
// '-', '*' '%%', '~', or a non-printable char.
351
383
func (s * LineSender ) StringColumn (name , val string ) * LineSender {
352
384
if ! s .prepareForField (name ) {
@@ -370,7 +402,7 @@ func (s *LineSender) StringColumn(name, val string) *LineSender {
370
402
// BoolColumn adds a boolean column value to the ILP message.
371
403
//
372
404
// Column name cannot contain any of the following characters:
373
- // '\n', '\r', '?', '.', ',', ''' , '\ "', '\ \', '/', ':', ')', '(', '+',
405
+ // '\n', '\r', '?', '.', ',', ”' , '"', '\', '/', ':', ')', '(', '+',
374
406
// '-', '*' '%%', '~', or a non-printable char.
375
407
func (s * LineSender ) BoolColumn (name string , val bool ) * LineSender {
376
408
if ! s .prepareForField (name ) {
0 commit comments