@@ -2,14 +2,11 @@ package main
22
33import (
44 "context"
5+ qdb "github.com/questdb/go-questdb-client/v3"
56 "log"
67 "time"
7-
8- qdb "github.com/questdb/go-questdb-client/v3"
98)
109
11- const dateOnly = "2006-01-02"
12-
1310func main () {
1411 ctx := context .TODO ()
1512 sender , err := qdb .NewLineSender (
@@ -33,32 +30,34 @@ func main() {
3330 }()
3431
3532 // Send a few ILP messages.
36- bday , err := time .Parse (dateOnly , "1856-07-10 " )
33+ tradedTs , err := time .Parse (time . RFC3339 , "2022-08-06T15:04:05.123456Z " )
3734 if err != nil {
3835 log .Fatal (err )
3936 }
4037 err = sender .
41- Table ("inventors_go" ).
42- Symbol ("born" , "Austrian Empire" ).
43- TimestampColumn ("birthdate" , bday ). // Epoch in micros.
44- Int64Column ("id" , 0 ).
45- StringColumn ("name" , "Nicola Tesla" ).
46- At (ctx , time .Now ()) // Epoch in nanos.
38+ Table ("trades_go" ).
39+ Symbol ("pair" , "USDGBP" ).
40+ Symbol ("type" , "buy" ).
41+ Float64Column ("traded_price" , 0.83 ).
42+ Float64Column ("limit_price" , 0.84 ).
43+ Int64Column ("qty" , 100 ).
44+ At (ctx , tradedTs )
4745 if err != nil {
4846 log .Fatal (err )
4947 }
5048
51- bday , err = time .Parse (dateOnly , "1847-02-11 " )
49+ tradedTs , err = time .Parse (time . RFC3339 , "2022-08-06T15:04:06.987654Z " )
5250 if err != nil {
5351 log .Fatal (err )
5452 }
5553 err = sender .
56- Table ("inventors_go" ).
57- Symbol ("born" , "USA" ).
58- TimestampColumn ("birthdate" , bday ).
59- Int64Column ("id" , 1 ).
60- StringColumn ("name" , "Thomas Alva Edison" ).
61- AtNow (ctx )
54+ Table ("trades_go" ).
55+ Symbol ("pair" , "GBPJPY" ).
56+ Symbol ("type" , "sell" ).
57+ Float64Column ("traded_price" , 135.97 ).
58+ Float64Column ("limit_price" , 0.84 ).
59+ Int64Column ("qty" , 400 ).
60+ At (ctx , tradedTs )
6261 if err != nil {
6362 log .Fatal (err )
6463 }
0 commit comments