• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.circleci/H11-Mar-2021-1714

.gitattributesH A D11-Mar-202132 31

.gitignoreH A D11-Mar-2021123 64

LICENSEH A D11-Mar-20211.1 KiB2116

README.mdH A D11-Mar-2021946 2316

encoder.goH A D11-Mar-20217.2 KiB304230

encoder_test.goH A D11-Mar-202116.9 KiB690669

escape.goH A D11-Mar-20216.3 KiB265226

escaper_test.goH A D11-Mar-20211.2 KiB6760

go.modH A D11-Mar-202152 42

go.sumH A D11-Mar-20210

handler.goH A D11-Mar-20212.9 KiB129105

machine.goH A D11-Mar-202154.4 KiB3,8293,252

machine.go.rlH A D11-Mar-20219.8 KiB550442

machine_test.goH A D11-Mar-202139 KiB2,2302,146

metric.goH A D11-Mar-20217.9 KiB429354

parser.goH A D11-Mar-20214.4 KiB193136

parser_test.goH A D11-Mar-202120.9 KiB955916

writer.goH A D11-Mar-20212.9 KiB131105

README.md

1# line-protocol
2
3This is an encoder for the influx [line protocol.](https://docs.influxdata.com/influxdb/latest/reference/syntax/line-protocol/)
4
5It has an interface similar to the standard library's `json.Encoder`.
6
7
8### some caveats.
9- It is not concurrency-safe.  If you want to make multiple calls to `Encoder.Encode` concurrently you have to manage the concurrency yourself.
10- It can only encode values that are uint64, int64, int, float32, float64, string, or bool.
11- Ints are converted to int64, float32's to float64.
12- If UintSupport is not set, uint64s are converted to int64's and if they are larger than the max int64, they get truncated to the max int64 instead of overflowing.
13
14
15### Example:
16```go
17buf := &bytes.Buffer{}
18serializer := protocol.NewEncoder(buf)
19serializer.SetMaxLineBytes(1024)
20serializer.SetFieldTypeSupport(UintSupport)
21serializer.Encode(e) // where e is something that implements the protocol.Metric interface
22```
23