Skip to content

Commit b0f26e5

Browse files
committed
docs: remove whitespace from readme
1 parent 493b95d commit b0f26e5

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

README.md

+48-48
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This repository contains the reference Go client for InfluxDB 2.
1717
- [Basic Example](#basic-example)
1818
- [Writes in Detail](#writes)
1919
- [Queries in Detail](#queries)
20-
- [Parametrized Queries](#parametrized-queries)
20+
- [Parametrized Queries](#parametrized-queries)
2121
- [Concurrency](#concurrency)
2222
- [Proxy and redirects](#proxy-and-redirects)
2323
- [Checking Server State](#checking-server-state)
@@ -27,22 +27,22 @@ This repository contains the reference Go client for InfluxDB 2.
2727

2828
## Features
2929

30-
- InfluxDB 2 client
31-
- Querying data
30+
- InfluxDB 2 client
31+
- Querying data
3232
- using the Flux language
3333
- into raw data, flux table representation
3434
- [How to queries](#queries)
3535
- Writing data using
3636
- [Line Protocol](https://docs.influxdata.com/influxdb/v2.0/reference/syntax/line-protocol/)
3737
- [Data Point](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/api/write#Point)
3838
- Both [asynchronous](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/api#WriteAPI) or [synchronous](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/api#WriteAPIBlocking) ways
39-
- [How to writes](#writes)
39+
- [How to writes](#writes)
4040
- InfluxDB 2 API
4141
- setup, ready, health
4242
- authotizations, users, organizations
4343
- buckets, delete
4444
- ...
45-
45+
4646
## Documentation
4747

4848
This section contains links to the client library documentation.
@@ -54,11 +54,11 @@ This section contains links to the client library documentation.
5454

5555
### Examples
5656

57-
Examples for basic writing and querying data are shown below in this document
57+
Examples for basic writing and querying data are shown below in this document
5858

5959
There are also other examples in the API docs:
60-
- [Client usage](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2?tab=doc#pkg-examples)
61-
- [Management APIs](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/api?tab=doc#pkg-examples)
60+
- [Client usage](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2?tab=doc#pkg-examples)
61+
- [Management APIs](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/api?tab=doc#pkg-examples)
6262

6363
## How To Use
6464

@@ -95,12 +95,12 @@ func main() {
9595
client := influxdb2.NewClient("http://localhost:8086", "my-token")
9696
// Use blocking write client for writes to desired bucket
9797
writeAPI := client.WriteAPIBlocking("my-org", "my-bucket")
98-
// Create point using full params constructor
98+
// Create point using full params constructor
9999
p := influxdb2.NewPoint("stat",
100100
map[string]string{"unit": "temperature"},
101101
map[string]interface{}{"avg": 24.5, "max": 45.0},
102102
time.Now())
103-
// write point immediately
103+
// write point immediately
104104
writeAPI.WritePoint(context.Background(), p)
105105
// Create point using fluent style
106106
p = influxdb2.NewPointWithMeasurement("stat").
@@ -118,7 +118,7 @@ func main() {
118118
if err != nil {
119119
panic(err)
120120
}
121-
121+
122122
// Get query client
123123
queryAPI := client.QueryAPI("my-org")
124124
// Get parser flux query result
@@ -151,10 +151,10 @@ client := influxdb2.NewClient("http://localhost:8086", "my-token")
151151
```
152152
will use the default options.
153153
154-
To set different configuration values, e.g. to set gzip compression and trust all server certificates, get default options
155-
and change what is needed:
154+
To set different configuration values, e.g. to set gzip compression and trust all server certificates, get default options
155+
and change what is needed:
156156
```go
157-
client := influxdb2.NewClientWithOptions("http://localhost:8086", "my-token",
157+
client := influxdb2.NewClientWithOptions("http://localhost:8086", "my-token",
158158
influxdb2.DefaultOptions().
159159
SetUseGZip(true).
160160
SetTLSConfig(&tls.Config{
@@ -163,17 +163,17 @@ client := influxdb2.NewClientWithOptions("http://localhost:8086", "my-token",
163163
```
164164
### Writes
165165
166-
Client offers two ways of writing, non-blocking and blocking.
166+
Client offers two ways of writing, non-blocking and blocking.
167167
168-
### Non-blocking write client
168+
### Non-blocking write client
169169
Non-blocking write client uses implicit batching. Data are asynchronously
170170
written to the underlying buffer and they are automatically sent to a server when the size of the write buffer reaches the batch size, default 5000, or the flush interval, default 1s, times out.
171171
Writes are automatically retried on server back pressure.
172172
173-
This write client also offers synchronous blocking method to ensure that write buffer is flushed and all pending writes are finished,
173+
This write client also offers synchronous blocking method to ensure that write buffer is flushed and all pending writes are finished,
174174
see [Flush()](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/api#WriteAPI.Flush) method.
175175
Always use [Close()](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2#Client.Close) method of the client to stop all background processes.
176-
176+
177177
Asynchronous write client is recommended for frequent periodic writes.
178178
179179
```go
@@ -183,13 +183,13 @@ import (
183183
"fmt"
184184
"math/rand"
185185
"time"
186-
186+
187187
"github.com/influxdata/influxdb-client-go/v2"
188188
)
189189
190190
func main() {
191191
// Create a new client using an InfluxDB server base URL and an authentication token
192-
// and set batch size to 20
192+
// and set batch size to 20
193193
client := influxdb2.NewClientWithOptions("http://localhost:8086", "my-token",
194194
influxdb2.DefaultOptions().SetBatchSize(20))
195195
// Get non-blocking write client
@@ -222,32 +222,32 @@ func main() {
222222
}
223223
```
224224
### Handling of failed async writes
225-
WriteAPI by default continues with retrying of failed writes.
225+
WriteAPI by default continues with retrying of failed writes.
226226
Retried are automatically writes that fail on a connection failure or when server returns response HTTP status code >= 429.
227227
228228
Retrying algorithm uses random exponential strategy to set retry time.
229229
The delay for the next retry attempt is a random value in the interval _retryInterval * exponentialBase^(attempts)_ and _retryInterval * exponentialBase^(attempts+1)_.
230-
If writes of batch repeatedly fails, WriteAPI continues with retrying until _maxRetries_ is reached or the overall retry time of batch exceeds _maxRetryTime_.
230+
If writes of batch repeatedly fails, WriteAPI continues with retrying until _maxRetries_ is reached or the overall retry time of batch exceeds _maxRetryTime_.
231231
232232
The defaults parameters (part of the WriteOptions) are:
233233
- _retryInterval_=5,000ms
234234
- _exponentialBase_=2
235235
- _maxRetryDelay_=125,000ms
236236
- _maxRetries_=5
237237
- _maxRetryTime_=180,000ms
238-
238+
239239
Retry delays are by default randomly distributed within the ranges:
240240
1. 5,000-10,000
241241
1. 10,000-20,000
242242
1. 20,000-40,000
243243
1. 40,000-80,000
244244
1. 80,000-125,000
245-
246-
Setting _retryInterval_ to 0 disables retry strategy and any failed write will discard the batch.
247245
248-
[WriteFailedCallback](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/api#WriteFailedCallback) allows advanced controlling of retrying.
246+
Setting _retryInterval_ to 0 disables retry strategy and any failed write will discard the batch.
247+
248+
[WriteFailedCallback](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/api#WriteFailedCallback) allows advanced controlling of retrying.
249249
It is synchronously notified in case async write fails.
250-
It controls further batch handling by its return value. If it returns `true`, WriteAPI continues with retrying of writes of this batch. Returned `false` means the batch should be discarded.
250+
It controls further batch handling by its return value. If it returns `true`, WriteAPI continues with retrying of writes of this batch. Returned `false` means the batch should be discarded.
251251
252252
### Reading async errors
253253
WriteAPI automatically logs write errors. Use [Errors()](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/api#WriteAPI.Errors) method, which returns the channel for reading errors occuring during async writes, for writing write error to a custom target:
@@ -299,7 +299,7 @@ func main() {
299299
}
300300
```
301301
302-
### Blocking write client
302+
### Blocking write client
303303
Blocking write client writes given point(s) synchronously. It doesn't do implicit batching. Batch is created from given set of points.
304304
Implicit batching can be enabled with `WriteAPIBlocking.EnableBatching()`.
305305
@@ -350,9 +350,9 @@ func main() {
350350
```
351351
352352
### Queries
353-
Query client offers retrieving of query results to a parsed representation in a [QueryTableResult](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/api#QueryTableResult) or to a raw string.
353+
Query client offers retrieving of query results to a parsed representation in a [QueryTableResult](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/api#QueryTableResult) or to a raw string.
354354
355-
### QueryTableResult
355+
### QueryTableResult
356356
QueryTableResult offers comfortable way how to deal with flux query CSV response. It parses CSV stream into FluxTableMetaData, FluxColumn and FluxRecord objects
357357
for easy reading the result.
358358
@@ -396,8 +396,8 @@ func main() {
396396
```
397397
398398
### Raw
399-
[QueryRaw()](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/api#QueryAPI.QueryRaw) returns raw, unparsed, query result string and process it on your own. Returned csv format
400-
can be controlled by the third parameter, query dialect.
399+
[QueryRaw()](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/api#QueryAPI.QueryRaw) returns raw, unparsed, query result string and process it on your own. Returned csv format
400+
can be controlled by the third parameter, query dialect.
401401
402402
```go
403403
package main
@@ -425,7 +425,7 @@ func main() {
425425
}
426426
// Ensures background processes finishes
427427
client.Close()
428-
}
428+
}
429429
```
430430
### Parametrized Queries
431431
InfluxDB Cloud supports [Parameterized Queries](https://docs.influxdata.com/influxdb/cloud/query-data/parameterized-queries/)
@@ -469,7 +469,7 @@ func main() {
469469
}
470470
// Query with parameters
471471
query := `from(bucket:"my-bucket")
472-
|> range(start: duration(params.start))
472+
|> range(start: duration(params.start))
473473
|> filter(fn: (r) => r._measurement == "stat")
474474
|> filter(fn: (r) => r._field == params.field)
475475
|> filter(fn: (r) => r._value > params.value)`
@@ -501,8 +501,8 @@ func main() {
501501
### Concurrency
502502
InfluxDB Go Client can be used in a concurrent environment. All its functions are thread-safe.
503503
504-
The best practise is to use a single `Client` instance per server URL. This ensures optimized resources usage,
505-
most importantly reusing HTTP connections.
504+
The best practise is to use a single `Client` instance per server URL. This ensures optimized resources usage,
505+
most importantly reusing HTTP connections.
506506
507507
For efficient reuse of HTTP resources among multiple clients, create an HTTP client and use `Options.SetHTTPClient()` for setting it to all clients:
508508
```go
@@ -528,7 +528,7 @@ For efficient reuse of HTTP resources among multiple clients, create an HTTP cli
528528
client2 := influxdb2.NewClientWithOptions("https://server:9999", "my-token2", influxdb2.DefaultOptions().SetHTTPClient(httpClient))
529529
```
530530
531-
Client ensures that there is a single instance of each server API sub-client for the specific area. E.g. a single `WriteAPI` instance for each org/bucket pair,
531+
Client ensures that there is a single instance of each server API sub-client for the specific area. E.g. a single `WriteAPI` instance for each org/bucket pair,
532532
a single `QueryAPI` for each org.
533533
534534
Such a single API sub-client instance can be used concurrently:
@@ -587,10 +587,10 @@ func main() {
587587
588588
### Proxy and redirects
589589
You can configure InfluxDB Go client behind a proxy in two ways:
590-
1. Using environment variable
591-
Set environment variable `HTTP_PROXY` (or `HTTPS_PROXY` based on the scheme of your server url).
590+
1. Using environment variable
591+
Set environment variable `HTTP_PROXY` (or `HTTPS_PROXY` based on the scheme of your server url).
592592
e.g. (linux) `export HTTP_PROXY=http://my-proxy:8080` or in Go code `os.Setenv("HTTP_PROXY","http://my-proxy:8080")`
593-
593+
594594
1. Configure `http.Client` to use proxy<br>
595595
Create a custom `http.Client` with a proxy configuration:
596596
```go
@@ -602,7 +602,7 @@ You can configure InfluxDB Go client behind a proxy in two ways:
602602
}
603603
client := influxdb2.NewClientWithOptions("http://localhost:8086", token, influxdb2.DefaultOptions().SetHTTPClient(httpClient))
604604
```
605-
605+
606606
Client automatically follows HTTP redirects. The default redirect policy is to follow up to 10 consecutive requests.
607607
Due to a security reason _Authorization_ header is not forwarded when redirect leads to a different domain.
608608
To overcome this limitation you have to set a custom redirect handler:
@@ -616,7 +616,7 @@ httpClient := &http.Client{
616616
},
617617
}
618618
client := influxdb2.NewClientWithOptions("http://localhost:8086", token, influxdb2.DefaultOptions().SetHTTPClient(httpClient))
619-
```
619+
```
620620
621621
### Checking Server State
622622
There are three functions for checking whether a server is up and ready for communication:
@@ -630,23 +630,23 @@ There are three functions for checking whether a server is up and ready for comm
630630
Only the [Ping()](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2#Client.Ping) function works in InfluxDB Cloud server.
631631
632632
## InfluxDB 1.8 API compatibility
633-
633+
634634
[InfluxDB 1.8.0 introduced forward compatibility APIs](https://docs.influxdata.com/influxdb/latest/tools/api/#influxdb-2-0-api-compatibility-endpoints) for InfluxDB 2.0. This allow you to easily move from InfluxDB 1.x to InfluxDB 2.0 Cloud or open source.
635-
635+
636636
Client API usage differences summary:
637637
1. Use the form `username:password` for an **authentication token**. Example: `my-user:my-password`. Use an empty string (`""`) if the server doesn't require authentication.
638638
1. The organization parameter is not used. Use an empty string (`""`) where necessary.
639639
1. Use the form `database/retention-policy` where a **bucket** is required. Skip retention policy if the default retention policy should be used. Examples: `telegraf/autogen`, `telegraf`.  
640-
640+
641641
The following forward compatible APIs are available:
642-
642+
643643
| API | Endpoint | Description |
644644
|:----------|:----------|:----------|
645645
| [WriteAPI](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/api#WriteAPI) (also [WriteAPIBlocking](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/api#WriteAPIBlocking))| [/api/v2/write](https://docs.influxdata.com/influxdb/v2.0/write-data/developer-tools/api/) | Write data to InfluxDB 1.8.0+ using the InfluxDB 2.0 API |
646646
| [QueryAPI](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2/api#QueryAPI) | [/api/v2/query](https://docs.influxdata.com/influxdb/v2.0/query-data/execute-queries/influx-api/) | Query data in InfluxDB 1.8.0+ using the InfluxDB 2.0 API and [Flux](https://docs.influxdata.com/flux/latest/) endpoint should be enabled by the [`flux-enabled` option](https://docs.influxdata.com/influxdb/v1.8/administration/config/#flux-enabled-false)
647-
| [Health()](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2#Client.Health) | [/health](https://docs.influxdata.com/influxdb/v2.0/api/#tag/Health) | Check the health of your InfluxDB instance |
647+
| [Health()](https://pkg.go.dev/github.com/influxdata/influxdb-client-go/v2#Client.Health) | [/health](https://docs.influxdata.com/influxdb/v2.0/api/#tag/Health) | Check the health of your InfluxDB instance |
648+
648649
649-
650650
### Example
651651
```go
652652
package main

0 commit comments

Comments
 (0)