Skip to content

Commit 40d1ed9

Browse files
author
Enric Sala
committed
Rename the host parameter, it should be url
1 parent 9efa5c7 commit 40d1ed9

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ Create an InfluxDB client instance and use it to interact with the server:
2929

3030
```matlab
3131
% Build an InfluxDB client
32-
HOST = 'http://localhost:8086';
32+
URL = 'http://localhost:8086';
3333
USER = 'user';
3434
PASS = 'password';
3535
DATABASE = 'server_stats';
36-
influxdb = InfluxDB(HOST, USER, PASS, DATABASE);
36+
influxdb = InfluxDB(URL, USER, PASS, DATABASE);
3737
3838
% Check the status of the InfluxDB instance
3939
[ok, ping] = influxdb.ping()

influxdb-client/InfluxDB.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
classdef InfluxDB < handle
22

33
properties(Access = private)
4-
Host = ''
4+
Url = ''
55
User = ''
66
Password = ''
77
Database = ''
@@ -11,8 +11,8 @@
1111

1212
methods
1313
% Constructor
14-
function obj = InfluxDB(host, user, password, database)
15-
obj.Host = host;
14+
function obj = InfluxDB(url, user, password, database)
15+
obj.Url = url;
1616
obj.User = user;
1717
obj.Password = password;
1818
obj.Database = database;
@@ -32,7 +32,7 @@
3232
function [ok, millis] = ping(obj)
3333
try
3434
timer = tic;
35-
webread([obj.Host '/ping']);
35+
webread([obj.Url '/ping']);
3636
millis = toc(timer) * 1000;
3737
ok = true;
3838
catch
@@ -43,7 +43,7 @@
4343

4444
% Show databases
4545
function databases = databases(obj)
46-
url = [obj.Host '/query'];
46+
url = [obj.Url '/query'];
4747
opts = weboptions('Timeout', obj.ReadTimeout, ...
4848
'Username', obj.User, 'Password', obj.Password);
4949
response = webread(url, 'q', 'SHOW DATABASES', opts);
@@ -57,7 +57,7 @@
5757

5858
% Execute a query string
5959
function result = runQuery(obj, query)
60-
url = [obj.Host '/query'];
60+
url = [obj.Url '/query'];
6161
opts = weboptions('Timeout', obj.ReadTimeout, ...
6262
'Username', obj.User, 'Password', obj.Password);
6363
response = webread(url, 'db', obj.Database, 'epoch', 'ms', 'q', query, opts);
@@ -96,7 +96,7 @@
9696
'consistency:unknown', '"%s" is not a valid consistency', consistency);
9797
params{end + 1} = ['consistency=' consistency];
9898
end
99-
url = [obj.Host '/write?' strjoin(params, '&')];
99+
url = [obj.Url '/write?' strjoin(params, '&')];
100100
weboptions('Timeout', obj.WriteTimeout, ...
101101
'Username', obj.User, 'Password', obj.Password);
102102
webwrite(url, lines, opts);

0 commit comments

Comments
 (0)