Point

public class Point
extension InfluxDBClient.Point: CustomStringConvertible

Point defines the values that will be written to the database.

  • Create a new Point with specified a measurement name and precision.

    Declaration

    Swift

    public init(_ measurement: String)

    Parameters

    measurement

    the measurement name

    precision

    the data point precision

  • Adds or replaces a tag value for this point.

    Declaration

    Swift

    @discardableResult
    public func addTag(key: String?, value: String?) -> Point

    Parameters

    key

    the tag name

    value

    the tag value

    Return Value

    self

  • Adds or replaces a field value for this point.

    Declaration

    Swift

    @discardableResult
    public func addField(key: String?, value: FieldValue?) -> Point

    Parameters

    key

    the field name

    value

    the field value

    Return Value

    self

  • Updates the timestamp for the point.

    Declaration

    Swift

    @discardableResult
    public func time(time: TimestampValue) -> Point

    Parameters

    time

    the timestamp. It can be Int or Date.

    Return Value

    self

  • Creates Line Protocol from Data Point.

    Declaration

    Swift

    public func toLineProtocol(precision: TimestampPrecision = defaultTimestampPrecision,
                               defaultTags: [String: String?]? = nil) throws -> String?

    Parameters

    precision

    the precision to use for the generated line protocol

    defaultTags

    default tags for Point.

    Return Value

    Line Protocol

  • Possible value types of Field

    See more

    Declaration

    Swift

    public enum FieldValue
  • Possible value types of Field

    See more

    Declaration

    Swift

    public enum TimestampValue : CustomStringConvertible
  • Tuple definition for construct Point.

    Declaration

    Swift

    public typealias Tuple = (measurement: String,
                              tags: [String?: String?]?,
                              fields: [String?: InfluxDBClient.Point.FieldValue?],
                              time: InfluxDBClient.Point.TimestampValue?)
  • Create a new Point from Tuple.

    Declaration

    Swift

    public class func fromTuple(_ tuple: Tuple) -> InfluxDBClient.Point

    Parameters

    tuple

    the tuple with keys: measurement, tags, fields and time

    precision

    the data point precision

    Return Value

    created Point

  • Line Protocol from Data Point.

    Declaration

    Swift

    public var description: String { get }