InfluxDBClient
public class InfluxDBClient
A InfluxDB Client providing a support for APIs to write and query data.
Example:
let options: InfluxDBClient.InfluxDBOptions = InfluxDBClient.InfluxDBOptions(
bucket: "my-bucket",
org: "my-org",
precision: .ns)
let client = InfluxDBClient(url: "http://localhost:8086", token: "my-token", options: options)
...
client.close()
-
Version of client.
Declaration
Swift
public static var version: String
-
InfluxDB host and port.
Declaration
Swift
public let url: String
-
Enable debugging for HTTP request/response.
Declaration
Swift
public let debugging: Bool
-
Shared URLSession across the client.
Declaration
Swift
public let session: URLSession
-
Lazy initialized
InvokableScriptsApi
.Declaration
Swift
public lazy var invokableScriptsApi: InvokableScriptsAPI { get set }
-
Create a new client for a InfluxDB.
Declaration
Swift
public init(url: String, token: String, options: InfluxDBOptions? = nil, debugging: Bool? = nil, protocolClasses: [AnyClass]? = nil)
Parameters
url
InfluxDB host and port.
token
Authentication token.
options
optional
InfluxDBOptions
to use for this client.debugging
optional Enable debugging for HTTP request/response. Default
false
.protocolClasses
optional array of extra protocol subclasses that handle requests.
-
Create a new client for InfluxDB 1.8 compatibility API.
Declaration
Swift
public convenience init(url: String, username: String, password: String, database: String, retentionPolicy: String, precision: TimestampPrecision = TimestampPrecision.ns, protocolClasses: [AnyClass]? = nil)
Parameters
url
InfluxDB host and port.
username
Username for authentication.
password
Password for authentication.
database
Target database.
retentionPolicy
Target retention policy.
precision
Default precision for the unix timestamps within the body line-protocol.
protocolClasses
optional array of extra protocol subclasses that handle requests.
-
Creates WriteApi with supplied default settings.
Declaration
Swift
public func makeWriteAPI(pointSettings: PointSettings? = nil) -> WriteAPI
Parameters
pointSettings
default settings for DataPoint, useful for default tags
Return Value
WriteAPI instance
-
Release all allocated resources.
Declaration
Swift
public func close()
-
Options to use when creating a
See moreInfluxDBClient
.Declaration
Swift
public struct InfluxDBOptions
-
The general InfluxDB error.
See moreDeclaration
Swift
public enum InfluxDBError : Error, CustomStringConvertible
-
Default Write Precision is Nanoseconds.
Declaration
Swift
public static let defaultTimestampPrecision: InfluxDBClient.TimestampPrecision
-
An enum represents the precision for the unix timestamps within the body line-protocol.
See moreDeclaration
Swift
public enum TimestampPrecision : String, Codable, CaseIterable
-
The logger for logging HTTP request/response.
See moreDeclaration
Swift
public class HTTPLogger
-
Point defines the values that will be written to the database.
See also
http://bit.ly/influxdata-pointDeclaration
-
Settings to store default tags.
Example:
See morelet defaultTags = InfluxDBClient.PointSettings() .addDefaultTag(key: "id", value: "132-987-655") .addDefaultTag(key: "customer", value: "California Miner") .addDefaultTag(key: "data_center", value: "${env.DATA_CENTER_LOCATION}")
Declaration
Swift
public class PointSettings