nimflux

InfluxDB API client library for Nim

Pure Nim score 15/100 · last commit 2021-11-23 · 1 stars · tests present · no docs generated

Summary

Latest Version Unknown
License Unknown
CI Status Failing
Stars 1
Forks 0
Open Issues 0
Last Commit 2021-11-23
Downloads 0
Last Indexed 2026-07-21 05:25

Installation

nimble install nimflux
choosenim install nimflux
git clone https://gitlab.com/tdely/nimflux

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
nimflux - - - - - - -

Source

Repository https://gitlab.com/tdely/nimflux
Homepage https://gitlab.com/tdely/nimflux
Registry Source gitlab

README

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()