No description
Find a file
2022-03-28 08:48:59 +02:00
.github/workflows Github action cleanup/improvement 2022-03-28 08:48:59 +02:00
src Release v1.0.3 2021-11-23 13:44:13 +01:00
tests Fix path for tests pkg import 2022-03-28 00:48:38 +02:00
CHANGELOG.md Release v1.0.3 2021-11-23 13:44:13 +01:00
LICENSE Add LICENSE 2021-02-26 08:35:31 +00:00
nimflux.nimble Release v1.0.3 2021-11-23 13:44:13 +01:00
README.md Update README.md 2021-06-29 16:14:04 +02:00

Nimflux

Nimflux is an InfluxDB API client library for Nim that can be used to ping, write, query, or send custom requests. The DataPoint type is used to easily create measurements for write, but it's also possible to send your own Line Protocol string should the need arise.

import nimflux

var data = DataPoint(measurement: "temp")
data.addTag("loc", "home")
data.addField("ambient", 22.0)

var client = newInfluxClient("localhost", "nimtest")
var resp = client.write(data)
assert resp.code.toInfluxStatus == Ok
resp = client.query("select * from temp")
echo resp.body

Asynchronous actions are also supported through AsyncInfluxClient:

import asyncdispatch, nimflux

var data = DataPoint(measurement: "temp")
data.addTag("loc", "home")
data.addField("ambient", 22.0)

proc asyncProc(data: DataPoint): Future[AsyncResponse] {.async.} =
  var client = newAsyncInfluxClient("localhost", "nimtest")
  var resp = await client.write(data)
  assert resp.code.toInfluxStatus == Ok
  return await client.query("select * from temp")

echo asyncProc(data).waitFor().body.waitFor()