@@ -9,7 +9,7 @@ Golang client for QuestDB's [Influx Line Protocol](https://questdb.io/docs/refer
9
9
The library requires Go 1.19 or newer.
10
10
11
11
Features:
12
- * Context-aware API.
12
+ * [ Context] ( https://www.digitalocean.com/community/tutorials/how-to-use-contexts-in-go ) -aware API.
13
13
* Optimized for batch writes.
14
14
* Supports TLS encryption and ILP authentication.
15
15
* Automatic write retries and connection reuse for ILP over HTTP.
@@ -43,23 +43,40 @@ func main() {
43
43
}
44
44
// Make sure to close the sender on exit to release resources.
45
45
defer sender.Close (ctx)
46
+
46
47
// Send a few ILP messages.
48
+ tradedTs , err := time.Parse (time.RFC3339 , " 2022-08-06T15:04:05.123456Z" )
49
+ if err != nil {
50
+ log.Fatal (err)
51
+ }
47
52
err = sender.
48
- Table (" trades" ).
49
- Symbol (" name" , " test_ilp1" ).
50
- Float64Column (" value" , 12.4 ).
51
- AtNow (ctx)
53
+ Table (" trades_go" ).
54
+ Symbol (" pair" , " USDGBP" ).
55
+ Symbol (" type" , " buy" ).
56
+ Float64Column (" traded_price" , 0.83 ).
57
+ Float64Column (" limit_price" , 0.84 ).
58
+ Int64Column (" qty" , 100 ).
59
+ At (ctx, tradedTs)
60
+ if err != nil {
61
+ log.Fatal (err)
62
+ }
63
+
64
+ tradedTs, err = time.Parse (time.RFC3339 , " 2022-08-06T15:04:06.987654Z" )
52
65
if err != nil {
53
66
log.Fatal (err)
54
67
}
55
68
err = sender.
56
- Table (" trades" ).
57
- Symbol (" name" , " test_ilp2" ).
58
- Float64Column (" value" , 11.4 ).
59
- At (ctx, time.Now ().UnixNano ())
69
+ Table (" trades_go" ).
70
+ Symbol (" pair" , " GBPJPY" ).
71
+ Symbol (" type" , " sell" ).
72
+ Float64Column (" traded_price" , 135.97 ).
73
+ Float64Column (" limit_price" , 0.84 ).
74
+ Int64Column (" qty" , 400 ).
75
+ At (ctx, tradedTs)
60
76
if err != nil {
61
77
log.Fatal (err)
62
78
}
79
+
63
80
// Make sure that the messages are sent over the network.
64
81
err = sender.Flush (ctx)
65
82
if err != nil {
0 commit comments