InfluxDB\Database::writePayload PHP Method

writePayload() public method

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.
return boolean
    public function writePayload($payload, $precision = self::PRECISION_NANOSECONDS, $retentionPolicy = null)
    {
        try {
            $parameters = ['url' => sprintf('write?db=%s&precision=%s', $this->name, $precision), 'database' => $this->name, 'method' => 'post'];
            if ($retentionPolicy !== null) {
                $parameters['url'] .= sprintf('&rp=%s', $retentionPolicy);
            }
            return $this->client->write($parameters, $payload);
        } catch (Exception $e) {
            throw new InfluxDBException($e->getMessage(), $e->getCode());
        }
    }