-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
42 lines (32 loc) · 835 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <iostream>
#include <utility>
#include <map>
#include <influxConnector.h>
using namespace std;
int main(int argc,char **argv){
string serverAddress,input;
int port;
if ( argc == 2 ){
port=8086;
serverAddress=*++argv;
}else if ( argc == 3 ){
serverAddress=*++argv;
port = atoi ( *++argv );
}else{
cout << "address [port]" << endl;
return -1;
}
influx::InfluxConnector con{serverAddress,port};
con.createDatabase("generatedDB",1,influx::Units::DAY,"oneDay");
//add some things
map<string,string> params{
{"one","1"},
{"two","2"}
};
con.write("generatedDB","levelSensor",params,100);
con.write("generatedDB","temperatureSensor",params,69);
cout<<"Press any key to drop DB"<<endl;
cin>>input;
con.dropDatabase("generatedDB");
return 0;
}