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
urlInfluxDB host and port.
tokenAuthentication token.
optionsoptional
InfluxDBOptionsto use for this client.debuggingoptional Enable debugging for HTTP request/response. Default
false.protocolClassesoptional 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
urlInfluxDB host and port.
usernameUsername for authentication.
passwordPassword for authentication.
databaseTarget database.
retentionPolicyTarget retention policy.
precisionDefault precision for the unix timestamps within the body line-protocol.
protocolClassesoptional array of extra protocol subclasses that handle requests.
-
Creates WriteApi with supplied default settings.
Declaration
Swift
public func makeWriteAPI(pointSettings: PointSettings? = nil) -> WriteAPIParameters
pointSettingsdefault 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 moreSee 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
View on GitHub
InfluxDBClient Class Reference