14
14
15
15
- [ Getting started] ( #getting-started )
16
16
- [ Usage] ( #usage )
17
- - [ Construction parameters] ( #construction -parameters )
17
+ - [ Configuration parameters] ( #configuration -parameters )
18
18
- [ Properties and methods] ( #properties-and-methods )
19
19
- [ Examples] ( #examples )
20
20
- [ FAQ] ( #faq- )
@@ -33,26 +33,27 @@ See: [https://www.nuget.org/packages/net-questdb-client/](https://www.nuget.org/
33
33
34
34
` Sender ` is single-threaded, and uses a single connection to the database.
35
35
36
- If you want to send in parallel, you can use multiple senders and standard async functionality
37
- to wait in parallel.
36
+ If you want to send in parallel, you can use multiple senders and standard async tasking.
37
+
38
+ See more in-depth documentation [ here] ( https://questdb.io/docs/clients/ingest-dotnet/ ) .
38
39
39
40
### Basic usage
40
41
41
- ``` c#
42
+ ``` csharp
42
43
using var sender = Sender .New (" http::addr=localhost:9000;" );
43
- sender .Table (" metric_name" )
44
+ await sender .Table (" metric_name" )
44
45
.Symbol (" Symbol" , " value" )
45
46
.Column (" number" , 10 )
46
47
.Column (" double" , 12 . 23 )
47
48
.Column (" string" , " born to shine" )
48
- .At (new DateTime (2021 , 11 , 25 , 0 , 46 , 26 ));
49
+ .AtAsync (new DateTime (2021 , 11 , 25 , 0 , 46 , 26 ));
49
50
await sender .SendAsync ();
50
51
```
51
52
52
53
### Multi-line send (sync)
53
54
54
- ``` c#
55
- using var sender = Sender .New (" http::addr=localhost:9000;" );
55
+ ``` csharp
56
+ using var sender = Sender .New (" http::addr=localhost:9000;auto_flush=off; " );
56
57
for (int i = 0 ; i < 100 ; i ++ )
57
58
{
58
59
sender .Table (" metric_name" )
@@ -70,7 +71,7 @@ Alternatively, it will flush every 1000ms.
70
71
71
72
This is equivalent to a config string of:
72
73
73
- ``` c#
74
+ ``` csharp
74
75
using var sender = Sender .New (" http:addr=localhost:9000;auto_flush=on;auto_flush_rows=75000;auto_flush_interval=1000;" );
75
76
```
76
77
@@ -79,45 +80,45 @@ the sender is disposed.
79
80
80
81
#### Flush every 1000 rows or every 1 second
81
82
82
- ``` c#
83
+ ``` csharp
83
84
using var sender = Sender .New (" http::addr=localhost:9000;auto_flush=on;auto_flush_rows=1000;" );
84
85
```
85
86
86
87
#### Flush every 5000 rows
87
88
88
- ``` c#
89
- using var sender = Sender .New (" http::addr=localhost:9000;auto_flush=on;auto_flush_rows=1000;auto_flush_interval=-1 ;" );
89
+ ``` csharp
90
+ using var sender = Sender .New (" http::addr=localhost:9000;auto_flush=on;auto_flush_rows=1000;auto_flush_interval=off ;" );
90
91
```
91
92
92
93
#### Flush after 5 seconds
93
94
94
- ``` c#
95
- using var sender = Sender .New (" http::addr=localhost:9000;auto_flush=on;auto_flush_interval=5000;" );
95
+ ``` csharp
96
+ using var sender = Sender .New (" http::addr=localhost:9000;auto_flush=on;auto_flush_rows=off; auto_flush_interval=5000;" );
96
97
```
97
98
98
99
#### Flush only when buffer is 4kb
99
100
100
- ``` c#
101
- using var sender = Sender .New (" http::addr=localhost:9000;auto_flush=on;auto_flush_bytes=4096;auto_flush_rows=-1 ;auto_flush_interval=-1 " );
101
+ ``` csharp
102
+ using var sender = Sender .New (" http::addr=localhost:9000;auto_flush=on;auto_flush_bytes=4096;auto_flush_rows=off ;auto_flush_interval=off; " );
102
103
```
103
104
104
105
### Authenticated
105
106
106
107
#### HTTP Authentication (Basic)
107
108
108
- ``` c#
109
+ ``` csharp
109
110
using var sender = Sender .New (" https::addr=localhost:9009;tls_verify=unsafe_off;username=admin;password=quest;" );;
110
111
```
111
112
112
113
#### HTTP Authentication (Token)
113
114
114
- ``` c#
115
+ ``` csharp
115
116
using var sender = Sender .New (" https::addr=localhost:9009;tls_verify=unsafe_off;username=admin;token=<bearer token>" );;
116
117
```
117
118
118
119
#### TCP Authentication
119
120
120
- ``` c#
121
+ ``` csharp
121
122
using var sender = Sender .New (" tcps::addr=localhost:9009;tls_verify=unsafe_off;username=admin;token=NgdiOWDoQNUP18WOnb1xkkEG5TzPYMda5SiUOvT1K0U=;" );
122
123
```
123
124
@@ -165,22 +166,27 @@ The config string format is:
165
166
166
167
## Properties and methods
167
168
168
- | Name | Returns | Description |
169
- | -------------------------------------------------------------------------------------------------------| -----------| ---------------------------------------------------------------------------|
170
- | ` Length ` | ` int ` | Current length in bytes of the buffer (not capacity!) |
171
- | ` RowCount ` | ` int ` | Current row count of the buffer |
172
- | ` WithinTransaction ` | ` bool ` | Whether or not the Sender is currently in a transactional state. |
173
- | ` Transaction(ReadOnlySpan<char>) ` | ` ISender ` | Starts a new transaction for the table. |
174
- | ` Commit() / CommitAsync() ` | ` Ibool ` | Commits the current transaction. |
175
- | ` Table(ReadOnlySpan<char>) ` | | |
176
- | ` Column(ReadOnlySpan<char>, ReadOnlySpan<char> / string / long / double / DateTime / DateTimeOffset) ` | ` ISender ` | Specify column name and value |
177
- | ` Column(ReadOnlySpan<char>, string? / long? / double? / DateTime? / DateTimeOffset?) ` | ` ISender ` | |
178
- | ` Symbol(ReadOnlySpan<char>, ReadOnlySpan<char> / string) ` | ` ISender ` | |
179
- | ` At(DateTime / DateTimeOffset / long) ` | | Designated timestamp for the line. For long, this is in unix nanoseconds. |
180
- | ` AtNow() ` | | Finishes line, leaving QuestDB server to set the timestamp |
181
- | ` Send() / SendAsync() ` | | Send IO Buffers to QuestDB |
182
- | ` CancelRow() ` | | Cancels current row. |
183
- | ` Truncate() ` | | Trims empty buffers. |
169
+ | Name | Returns | Description |
170
+ | -------------------------------------------------------------------------------------------------------| -----------------| ----------------------------------------------------------------------------|
171
+ | ` Length ` | ` int ` | Current length in bytes of the buffer (not capacity!) |
172
+ | ` RowCount ` | ` int ` | Current row count of the buffer |
173
+ | ` LastFlush ` | ` DateTime ` | Returns the UTC DateTime of the last flush sending data to the server. |
174
+ | ` WithinTransaction ` | ` bool ` | Whether or not the Sender is currently in a transactional state. |
175
+ | ` Transaction(ReadOnlySpan<char>) ` | ` ISender ` | Starts a new transaction for the table. |
176
+ | ` Commit() / CommitAsync() ` | ` void ` / ` Task ` | Commits the current transaction. |
177
+ | ` Rollback() ` | ` void ` | Rolls back the current unsent transaction. |
178
+ | ` Table(ReadOnlySpan<char>) ` | ` ISender ` | Sets the table name for the next row. |
179
+ | ` Column(ReadOnlySpan<char>, ReadOnlySpan<char> / string / long / double / DateTime / DateTimeOffset) ` | ` ISender ` | Specify column name and value |
180
+ | ` Column(ReadOnlySpan<char>, string? / long? / double? / DateTime? / DateTimeOffset?) ` | ` ISender ` | Specify column name and value |
181
+ | ` Symbol(ReadOnlySpan<char>, ReadOnlySpan<char> / string) ` | ` ISender ` | Specify a symbol column name and value |
182
+ | ` At(DateTime / DateTimeOffset / long, CancellationToken) ` | ` void ` | Designated timestamp for the line. May flush data according to auto-flush. |
183
+ | ` AtAsync(DateTime / DateTimeOffset / long, CancellationToken) ` | ` ValueTask ` | Designated timestamp for the line. May flush data according to auto-flush. |
184
+ | ` AtNow(CancellationToken) ` | ` void ` | Finishes line, leaving the QuestDB server to set the timestamp |
185
+ | ` AtNowAsync(CancellationToken) ` | ` ValueTask ` | Finishes line, leaving the QuestDB server to set the timestamp |
186
+ | ` Send() / SendAsync() ` | ` void ` / ` Task ` | Send IO Buffers to QuestDB |
187
+ | ` CancelRow() ` | ` void ` | Cancels current row. |
188
+ | ` Truncate() ` | ` void ` | Trims empty buffers. |
189
+ | ` Clear() ` | ` void ` | Clears the sender's buffer. |
184
190
185
191
## Examples
186
192
@@ -191,12 +197,13 @@ The config string format is:
191
197
192
198
### Does this client perform both read and write operations?
193
199
194
- No. This client is for write only. For querying, see
200
+ No. This client is for writing data only. For querying, see
195
201
the [ Query & SQL overview] ( https://questdb.io/docs/reference/sql/overview/ )
196
202
197
203
### Where do I report issues with the client?
198
204
199
- If something is not working as expected, please open an [ issue] ( https://github.com/questdb/net-questdb-client/issues/new ) .
205
+ If something is not working as expected, please open
206
+ an [ issue] ( https://github.com/questdb/net-questdb-client/issues/new ) .
200
207
201
208
### Where can I learn more about QuestDB?
202
209
0 commit comments