InfluxDB PHP Client
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
InfluxDB2\Point Class Reference

Public Member Functions

 __construct ( $name, $tags=null, $fields=null, $time=null, $precision=Point::DEFAULT_WRITE_PRECISION)
 
 getPrecision ()
 
 addTag ($key, ?string $value)
 
 addField ($key, $value)
 
 time ($time, $precision=null)
 
 toLineProtocol ()
 

Static Public Member Functions

static measurement ($name)
 
static fromArray ($data)
 

Public Attributes

const DEFAULT_WRITE_PRECISION = WritePrecision::NS
 

Constructor & Destructor Documentation

◆ __construct()

InfluxDB2\Point::__construct ( $name,
$tags = null,
$fields = null,
$time = null,
$precision = Point::DEFAULT_WRITE_PRECISION )

Create DataPoint instance for specified measurement name.

Parameters
[String]name the measurement name for the point.
[Array]tags the tag set for the point
[Array]fields the fields for the point
[Integer]time the timestamp for the point
[WritePrecision]precision the precision for the unix timestamps within the body line-protocol

Member Function Documentation

◆ addField()

InfluxDB2\Point::addField ( $key,
$value )

Adds or replaces a field value for a point.

Parameters
[Object]key the tag name
[Object]value the tag value
Returns
Point

◆ addTag()

InfluxDB2\Point::addTag ( $key,
?string $value )

Adds or replaces a tag value for a point.

Parameters
[Object]key the tag name
string | object | null$valuethe tag value, can be "object" with "__toString" function or "object" implements Stringable interface
Returns
Point

◆ fromArray()

static InfluxDB2\Point::fromArray ( $data)
static

Create DataPoint instance from specified data.

Parameters
[Array]data
Returns
Point

◆ getPrecision()

InfluxDB2\Point::getPrecision ( )
Returns
WritePrecision

◆ time()

InfluxDB2\Point::time ( $time,
$precision = null )

Updates the timestamp for the point.

Parameters
[Object]time the timestamp
[WritePrecision]precision the timestamp precision
Returns
Point

◆ toLineProtocol()

InfluxDB2\Point::toLineProtocol ( )

If there is no field then return null.

Returns
string representation of the point

The documentation for this class was generated from the following file: