File tree Expand file tree Collapse file tree 3 files changed +110
-0
lines changed Expand file tree Collapse file tree 3 files changed +110
-0
lines changed Original file line number Diff line number Diff line change 1+ # manifest file lets questdb.io find the examples and lets Cloud docs
2+ # substitute host/port and auth keys when auto-generating examples
3+ - name : ilp
4+ lang : go
5+ path : examples/basic/main.go
6+ header : |-
7+ Go client library [docs](https://pkg.go.dev/github.com/questdb/go-questdb-client)
8+ and [repo](https://github.com/questdb/go-questdb-client).
9+ - name : ilp-auth-tls
10+ lang : go
11+ path : examples/auth-and-tls/main.go
12+ header : |-
13+ Go client library [docs](https://pkg.go.dev/github.com/questdb/go-questdb-client)
14+ and [repo](https://github.com/questdb/go-questdb-client).
15+ auth :
16+ kid : testUser1
17+ d : 5UjEMuA0Pj5pjK8a-fa24dyIf-Es5mYny3oE_Wmus48
18+ addr :
19+ host : localhost
20+ port : 9009
Original file line number Diff line number Diff line change 1+ package main
2+
3+ import (
4+ "context"
5+ "log"
6+ "time"
7+
8+ qdb "github.com/questdb/go-questdb-client"
9+ )
10+
11+ func main () {
12+ ctx := context .TODO ()
13+ sender , err := qdb .NewLineSender (
14+ ctx ,
15+ qdb .WithAddress ("localhost:9009" ),
16+ qdb .WithAuth (
17+ "testUser1" ,
18+ "5UjEMuA0Pj5pjK8a-fa24dyIf-Es5mYny3oE_Wmus48" ),
19+ qdb .WithTls (),
20+ )
21+ if err != nil {
22+ log .Fatal (err )
23+ }
24+ // Make sure to close the sender on exit to release resources.
25+ defer sender .Close ()
26+ // Send a few ILP messages.
27+ err = sender .
28+ Table ("trades" ).
29+ Symbol ("name" , "test_ilp1" ).
30+ Float64Column ("value" , 12.4 ).
31+ At (ctx , time .Now ().UnixNano ())
32+ if err != nil {
33+ log .Fatal (err )
34+ }
35+ err = sender .
36+ Table ("trades" ).
37+ Symbol ("name" , "test_ilp2" ).
38+ Float64Column ("value" , 11.4 ).
39+ At (ctx , time .Now ().UnixNano ())
40+ if err != nil {
41+ log .Fatal (err )
42+ }
43+ // Make sure that the messages are sent over the network.
44+ err = sender .Flush (ctx )
45+ if err != nil {
46+ log .Fatal (err )
47+ }
48+ }
Original file line number Diff line number Diff line change 1+ package main
2+
3+ import (
4+ "context"
5+ "log"
6+ "time"
7+
8+ qdb "github.com/questdb/go-questdb-client"
9+ )
10+
11+ func main () {
12+ ctx := context .TODO ()
13+ // Connect to QuestDB running on 127.0.0.1:9009
14+ sender , err := qdb .NewLineSender (ctx )
15+ if err != nil {
16+ log .Fatal (err )
17+ }
18+ // Make sure to close the sender on exit to release resources.
19+ defer sender .Close ()
20+ // Send a few ILP messages.
21+ err = sender .
22+ Table ("trades" ).
23+ Symbol ("name" , "test_ilp1" ).
24+ Float64Column ("value" , 12.4 ).
25+ At (ctx , time .Now ().UnixNano ())
26+ if err != nil {
27+ log .Fatal (err )
28+ }
29+ err = sender .
30+ Table ("trades" ).
31+ Symbol ("name" , "test_ilp2" ).
32+ Float64Column ("value" , 11.4 ).
33+ At (ctx , time .Now ().UnixNano ())
34+ if err != nil {
35+ log .Fatal (err )
36+ }
37+ // Make sure that the messages are sent over the network.
38+ err = sender .Flush (ctx )
39+ if err != nil {
40+ log .Fatal (err )
41+ }
42+ }
You can’t perform that action at this time.
0 commit comments