@@ -252,7 +252,7 @@ func (s *LineSender) Close() error {
252252// called before any Symbol or Column method.
253253//
254254// Table name cannot contain any of the following characters:
255- // '\n', '\r', '?', ',', '' ', '"', '\', '/', ':', ')', '(', '+', '*',
255+ // '\n', '\r', '?', ',', " ', '"', '\', '/', ':', ')', '(', '+', '*',
256256// '%', '~', starting '.', trailing '.', or a non-printable char.
257257func (s * LineSender ) Table (name string ) * LineSender {
258258 if s .lastErr != nil {
@@ -274,7 +274,7 @@ func (s *LineSender) Table(name string) *LineSender {
274274// before any Column method.
275275//
276276// Symbol name cannot contain any of the following characters:
277- // '\n', '\r', '?', '.', ',', ''' , '\ "', '\\', '/', ':', ')', '(', '+',
277+ // '\n', '\r', '?', '.', ',', "' , '"', '\\', '/', ':', ')', '(', '+',
278278// '-', '*' '%%', '~', or a non-printable char.
279279func (s * LineSender ) Symbol (name , val string ) * LineSender {
280280 if s .lastErr != nil {
@@ -306,7 +306,7 @@ func (s *LineSender) Symbol(name, val string) *LineSender {
306306// message.
307307//
308308// Column name cannot contain any of the following characters:
309- // '\n', '\r', '?', '.', ',', ''' , '\ "', '\\', '/', ':', ')', '(', '+',
309+ // '\n', '\r', '?', '.', ',', "' , '"', '\\', '/', ':', ')', '(', '+',
310310// '-', '*' '%%', '~', or a non-printable char.
311311func (s * LineSender ) Int64Column (name string , val int64 ) * LineSender {
312312 if ! s .prepareForField (name ) {
@@ -323,11 +323,43 @@ func (s *LineSender) Int64Column(name string, val int64) *LineSender {
323323 return s
324324}
325325
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+ 326358// Float64Column adds a 64-bit float (double) column value to the ILP
327359// message.
328360//
329361// Column name cannot contain any of the following characters:
330- // '\n', '\r', '?', '.', ',', ''' , '\ "', '\ \', '/', ':', ')', '(', '+',
362+ // '\n', '\r', '?', '.', ',', "' , '"', '\', '/', ':', ')', '(', '+',
331363// '-', '*' '%%', '~', or a non-printable char.
332364func (s * LineSender ) Float64Column (name string , val float64 ) * LineSender {
333365 if ! s .prepareForField (name ) {
@@ -346,7 +378,7 @@ func (s *LineSender) Float64Column(name string, val float64) *LineSender {
346378// StringColumn adds a string column value to the ILP message.
347379//
348380// Column name cannot contain any of the following characters:
349- // '\n', '\r', '?', '.', ',', ''' , '\ "', '\ \', '/', ':', ')', '(', '+',
381+ // '\n', '\r', '?', '.', ',', "' , '"', '\', '/', ':', ')', '(', '+',
350382// '-', '*' '%%', '~', or a non-printable char.
351383func (s * LineSender ) StringColumn (name , val string ) * LineSender {
352384 if ! s .prepareForField (name ) {
@@ -370,7 +402,7 @@ func (s *LineSender) StringColumn(name, val string) *LineSender {
370402// BoolColumn adds a boolean column value to the ILP message.
371403//
372404// Column name cannot contain any of the following characters:
373- // '\n', '\r', '?', '.', ',', ''' , '\ "', '\ \', '/', ':', ')', '(', '+',
405+ // '\n', '\r', '?', '.', ',', "' , '"', '\', '/', ':', ')', '(', '+',
374406// '-', '*' '%%', '~', or a non-printable char.
375407func (s * LineSender ) BoolColumn (name string , val bool ) * LineSender {
376408 if ! s .prepareForField (name ) {
0 commit comments