Skip to content

Commit 06b46de

Browse files
author
Stephen Hoogendijk
committed
Corrected documentation and added more examples
1 parent a054bce commit 06b46de

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

README.md

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ To fetch records from InfluxDB you can do a query directly on a database:
4646

4747
```php
4848

49-
// fetch the selectDB
49+
// fetch the database
5050
$database = $client->selectDB('influx_test_db');
5151

5252
// executing a query will yield a resultset object
@@ -84,24 +84,25 @@ Writing data is done by providing an array of points to the writePoints method o
8484

8585
```php
8686

87-
$newPoints = $database->writePoints(
88-
array(
89-
new Point(
90-
'test_metric',
91-
0.64,
92-
array('host' => 'server01', 'region' => 'us-west'),
93-
array('cpucount' => 10),
94-
1435255849
95-
),
96-
new Point(
97-
'test_metric',
98-
0.84,
99-
array('host' => 'server01', 'region' => 'us-west'),
100-
array('cpucount' => 10),
101-
1435255850
102-
)
87+
// create an array of points
88+
$points = array(
89+
new Point(
90+
'test_metric',
91+
0.64,
92+
array('host' => 'server01', 'region' => 'us-west'),
93+
array('cpucount' => 10),
94+
1435255849
95+
),
96+
new Point(
97+
'test_metric',
98+
0.84,
99+
array('host' => 'server01', 'region' => 'us-west'),
100+
array('cpucount' => 10),
101+
1435255850
103102
)
104103
);
104+
105+
$newPoints = $database->writePoints($points);
105106

106107
```
107108

@@ -123,7 +124,7 @@ This library makes it easy to provide a retention policy when creating a databas
123124
// create the client
124125
$client = new \InfluxDB\Client($host, $port, '', '');
125126

126-
// select the selectDB
127+
// select the database
127128
$database = $client->selectDB('influx_test_db');
128129

129130
// create the database with a retention policy
@@ -143,6 +144,12 @@ and list them:
143144
$result = $database->listRetentionPolicies();
144145
```
145146

147+
You can add more retention policies to a database:
148+
149+
```php
150+
$result = $database->createRetentionPolicy(new RetentionPolicy('test2', '30d', 1, true));
151+
```
152+
146153
### Client functions
147154

148155
Some functions are too general for a database. So these are available in the client:

0 commit comments

Comments
 (0)