PHP Class InfluxDB\Database

Author: Stephen "TheCodeAssassin" Hoogendijk
Afficher le fichier Open project: influxdb/influxdb-php Class Usage Examples

Protected Properties

Свойство Type Description
$client Client
$name string The name of the Database

Méthodes publiques

Méthode Description
__construct ( string $name, Client $client ) Construct a database object
alterRetentionPolicy ( InfluxDB\Database\RetentionPolicy $retentionPolicy )
create ( InfluxDB\Database\RetentionPolicy $retentionPolicy = null, boolean $createIfNotExists = true ) : influxdb\ResultSet Create this database
createRetentionPolicy ( InfluxDB\Database\RetentionPolicy $retentionPolicy ) : influxdb\ResultSet
drop ( ) Drop this database
exists ( ) : boolean
getClient ( ) : Client
getName ( ) : string
getQueryBuilder ( ) : InfluxDB\Query\Builder Retrieve the query builder
listRetentionPolicies ( ) : array
query ( string $query, array $params = [] ) : influxdb\ResultSet Query influxDB
writePayload ( string | array $payload, string $precision = self::PRECISION_NANOSECONDS, string | null $retentionPolicy = null ) : boolean Write a payload into InfluxDB using the current driver. This method is similar to writePoints(), except it takes a string payload instead of an array of Points. This is useful in the following situations:
writePoints ( array $points, string $precision = self::PRECISION_NANOSECONDS, string | null $retentionPolicy = null ) : boolean Write points into InfluxDB using the current driver. This is the recommended method for inserting data into InfluxDB.

Méthodes protégées

Méthode Description
getRetentionPolicyQuery ( string $method, InfluxDB\Database\RetentionPolicy $retentionPolicy ) : string

Method Details

__construct() public méthode

Construct a database object
public __construct ( string $name, Client $client )
$name string
$client Client

alterRetentionPolicy() public méthode

public alterRetentionPolicy ( InfluxDB\Database\RetentionPolicy $retentionPolicy )
$retentionPolicy InfluxDB\Database\RetentionPolicy

create() public méthode

Create this database
public create ( InfluxDB\Database\RetentionPolicy $retentionPolicy = null, boolean $createIfNotExists = true ) : influxdb\ResultSet
$retentionPolicy InfluxDB\Database\RetentionPolicy
$createIfNotExists boolean Only create the database if it does not yet exist
Résultat influxdb\ResultSet

createRetentionPolicy() public méthode

public createRetentionPolicy ( InfluxDB\Database\RetentionPolicy $retentionPolicy ) : influxdb\ResultSet
$retentionPolicy InfluxDB\Database\RetentionPolicy
Résultat influxdb\ResultSet

drop() public méthode

Drop this database
public drop ( )

exists() public méthode

public exists ( ) : boolean
Résultat boolean

getClient() public méthode

public getClient ( ) : Client
Résultat Client

getName() public méthode

public getName ( ) : string
Résultat string

getQueryBuilder() public méthode

Retrieve the query builder
public getQueryBuilder ( ) : InfluxDB\Query\Builder
Résultat InfluxDB\Query\Builder

getRetentionPolicyQuery() protected méthode

protected getRetentionPolicyQuery ( string $method, InfluxDB\Database\RetentionPolicy $retentionPolicy ) : string
$method string
$retentionPolicy InfluxDB\Database\RetentionPolicy
Résultat string

listRetentionPolicies() public méthode

public listRetentionPolicies ( ) : array
Résultat array

query() public méthode

Query influxDB
public query ( string $query, array $params = [] ) : influxdb\ResultSet
$query string
$params array
Résultat influxdb\ResultSet

writePayload() public méthode

1) Performing unique queries that may not conform to the current Point standard. 2) Inserting very large set of points into a measurement where looping via array_map() actually hurts performance as the payload may be calculated in advance by caller.
public writePayload ( string | array $payload, string $precision = self::PRECISION_NANOSECONDS, string | null $retentionPolicy = null ) : boolean
$payload string | array InfluxDB payload (Or array of payloads) that conform to the Line syntax.
$precision string The timestamp precision (defaults to nanoseconds).
$retentionPolicy string | null Specifies an explicit retention policy to use when writing all points. If not set, the default retention period will be used. This is only applicable for the Guzzle driver. The UDP driver utilizes the endpoint configuration defined in the server's influxdb configuration file.
Résultat boolean

writePoints() public méthode

Write points into InfluxDB using the current driver. This is the recommended method for inserting data into InfluxDB.
public writePoints ( array $points, string $precision = self::PRECISION_NANOSECONDS, string | null $retentionPolicy = null ) : boolean
$points array Array of Point objects
$precision string The timestamp precision (defaults to nanoseconds).
$retentionPolicy string | null Specifies an explicit retention policy to use when writing all points. If not set, the default retention period will be used. This is only applicable for the Guzzle driver. The UDP driver utilizes the endpoint configuration defined in the server's influxdb configuration file.
Résultat boolean

Property Details

$client protected_oe property

protected Client,influxdb $client
Résultat Client

$name protected_oe property

The name of the Database
protected string $name
Résultat string