Skip to content

Commit

Permalink
Merge pull request #2 from test-results-reporter/v2-setup
Browse files Browse the repository at this point in the history
feat: support v2 write
  • Loading branch information
ASaiAnudeep authored Oct 23, 2023
2 parents 9a89cd4 + da32961 commit 3947ede
Show file tree
Hide file tree
Showing 10 changed files with 1,155 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
node-version: [8.x, 10.x, 12.x, 14.x]
node-version: [12.x, 14.x, 18.x]

steps:
- uses: actions/checkout@v2
Expand Down
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 3947ede

Please sign in to comment.