Skip to content

Commit

Permalink
feat: support v2 write
Browse files Browse the repository at this point in the history
  • Loading branch information
ASaiAnudeep committed Oct 23, 2023
1 parent 9a89cd4 commit 3bd865e
Show file tree
Hide file tree
Showing 9 changed files with 1,154 additions and 40 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Publish
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v2
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- run: npm install
- run: npm test
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
43 changes: 40 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# influxdb-v1
# influxdb-lite

A light-weight library to write data to InfluxDB.

Expand All @@ -7,8 +7,10 @@ A light-weight library to write data to InfluxDB.

## Example

### Influx DB v1

```javascript
const influx = require('influxdb-v1');
const influx = require('influxdb-lite');

await influx.write(
{
Expand Down Expand Up @@ -52,12 +54,47 @@ await db.query('SELECT * FROM measurement');
await db.flux('from(bucket:"telegraf")');
```

### Influx DB v2

```javascript
const influx = require('influxdb-lite');

await influx.write(
{
url: 'http://influx.url',
version: 'v2',
bucket: 'bucket name',
org: 'org',
token: 'token',
},
[
{
measurement: 'web',
fields: {
load: 12.34
}
},
{
measurement: 'web',
fields: {
load: 5.4
},
tags: {
host: 'linux'
},
timestamp: Date.now()
}
]
);
```


## CLI

### Insert Data

```shell
npx influxdb-v1 insert --url <influx-base-url> --username <user> --password <pass> --db <database> --measurement <measurement> --tags "key=value" --fields "key=value" --ts <timestamp>
npx influxdb-lite insert --url <influx-base-url> --username <user> --password <pass> --db <database> --measurement <measurement> --tags "key=value" --fields "key=value" --ts <timestamp>
```

### Note
Expand Down
Loading

0 comments on commit 3bd865e

Please sign in to comment.