Point defines values of a single measurement.

Methods

  • Gets the boolean field value associated with the specified name. Throws if actual type of field with given name is not boolean. If the field is not present, returns undefined.

    Parameters

    • name: string

      field name

    Returns boolean

    The boolean field value or undefined.

    PointValues.GetFieldTypeMissmatchError Actual type of field doesn't match boolean type.

  • Get field of numeric type.

    Parameters

    • name: string

      field name

    • type: "float" | "integer" | "uinteger"

      field numeric type

    Returns number

    this

    Field type doesn't match actual type

  • Get field of string type.

    Parameters

    • name: string

      field name

    • type: "string"

      field string type

    Returns string

    this

    Field type doesn't match actual type

  • Get field of boolean type.

    Parameters

    • name: string

      field name

    • type: "boolean"

      field boolean type

    Returns boolean

    this

    Field type doesn't match actual type

  • Get field without type check.

    Parameters

    • name: string

      field name

    Returns string | number | boolean

    this

  • Gets an array of field names associated with this object.

    Returns string[]

    An array of field names.

  • Gets the float field value associated with the specified name. Throws if actual type of field with given name is not float. If the field is not present, returns undefined.

    Parameters

    • name: string

      field name

    Returns number

    The float field value or undefined.

    PointValues.GetFieldTypeMissmatchError Actual type of field doesn't match float type.

  • Gets the integer field value associated with the specified name. Throws if actual type of field with given name is not integer. If the field is not present, returns undefined.

    Parameters

    • name: string

      field name

    Returns number

    The integer field value or undefined.

    PointValues.GetFieldTypeMissmatchError Actual type of field doesn't match integer type.

  • Gets the string field value associated with the specified name. Throws if actual type of field with given name is not string. If the field is not present, returns undefined.

    Parameters

    • name: string

      field name

    Returns string

    The string field value or undefined.

    PointValues.GetFieldTypeMissmatchError Actual type of field doesn't match string type.

  • Gets value of tag with given name. Returns undefined if tag not found.

    Parameters

    • name: string

      tag name

    Returns string

    tag value or undefined

  • Get timestamp. Can be undefined if not set.

    Returns string | number | Date

    timestamp or undefined

  • Gets the uint field value associated with the specified name. Throws if actual type of field with given name is not uint. If the field is not present, returns undefined.

    Parameters

    • name: string

      field name

    Returns number

    The uint field value or undefined.

    PointValues.GetFieldTypeMissmatchError Actual type of field doesn't match uint type.

  • Checks if this object has any fields.

    Returns boolean

    true if fields are present, false otherwise.

  • Removes a field with the specified name if it exists; otherwise, it does nothing.

    Parameters

    • name: string

      The name of the field to be removed.

    Returns Point

    this

  • Removes a tag with the specified name if it exists; otherwise, it does nothing.

    Parameters

    • name: string

      The name of the tag to be removed.

    Returns Point

    this

  • Add fields according to their type. All numeric type is considered float

    Parameters

    • fields: { [key: string]: string | number | boolean }

      name-value map

    Returns Point

    this

  • Sets a number field.

    Parameters

    • name: string

      field name

    • value: any

      field value

    Returns Point

    this

    NaN/Infinity/-Infinity is supplied

  • Sets an integer field.

    Parameters

    • name: string

      field name

    • value: any

      field value

    Returns Point

    this

    NaN or out of int64 range value is supplied

  • Sets a tag. The caller has to ensure that both name and value are not empty and do not end with backslash.

    Parameters

    • name: string

      tag name

    • value: string

      tag value

    Returns Point

    this

  • Sets point timestamp. Timestamp can be specified as a Date (preferred), number, string or an undefined value. An undefined value instructs to assign a local timestamp using the client's clock. An empty string can be used to let the server assign the timestamp. A number value represents time as a count of time units since epoch, the exact time unit then depends on the precision of the API that writes the point.

    Beware that the current time in nanoseconds can't precisely fit into a JS number, which can hold at most 2^53 integer number. Nanosecond precision numbers are thus supplied as a (base-10) string. An application can also use ES2020 BigInt to represent nanoseconds, BigInt's toString() returns the required high-precision string.

    Note that InfluxDB requires the timestamp to fit into int64 data type.

    Parameters

    • value: string | number | Date

      point time

    Returns Point

    this

  • Sets an unsigned integer field.

    Parameters

    • name: string

      field name

    • value: any

      field value

    Returns Point

    this

    NaN out of range value is supplied

  • Creates an InfluxDB protocol line out of this instance.

    Parameters

    • OptionalconvertTimePrecision: WritePrecision | TimeConverter

      settings control serialization of a point timestamp and can also add default tags, nanosecond timestamp precision is used when no settings or no settings.convertTime is supplied.

    • OptionaldefaultTags: { [key: string]: string }

    Returns string

    an InfluxDB protocol line out of this instance