@badmachine/influxdb3-napi
Version:
Influxdb3 client written in rust and built for nodejs with napi-rs
153 lines (137 loc) • 5.21 kB
TypeScript
/* auto-generated by NAPI-RS */
/* eslint-disable */
export declare class InfluxDbClient {
constructor(addr: string, token?: string | undefined | null, serializer?: Serializer | undefined | null, options?: FlightOptions | undefined | null)
query(queryPayload: QueryPayload): ReadableStream<LibraryReturnType> | ReadableStream<Record<string, any>> | ReadableStream<Buffer>
/**
* # Safety
*
* This function should not be called before the horsemen are ready.
*/
write(lines: Array<string>, database: string, writeOptions?: WriteOptions | undefined | null, org?: string | undefined | null): Promise<void>
}
export type InfluxDBClient = InfluxDbClient
export declare class Point {
constructor(measurement: string)
static fromMeasurement(measurement: string): Point
get measurement(): string | null
set measurement(measurement: string)
get timestamp(): number | null
set timestamp(timestamp: number)
getTag(tagName: string): void
setTag(name: string, value: string): void
removeTag(name: string): void
get tagNames(): Array<string>
getFloatField(name: string): number | null
setFloatField(name: string, value: number): void
getIntField(name: string): number | null
setIntField(name: string, value: number): void
getUintegerField(name: string): number | null
setUintegerField(name: string, value: number): void
getStringField(name: string): string | null
setStringField(name: string, value: string): void
getBooleanField(name: string): boolean | null
setBooleanField(name: string, value: boolean): void
getFieldType(name: string): PointFieldType | null
setFields(values: Record<string, any>): void
removeField(name: string): void
getFieldNames(): Array<string>
hasFields(): boolean
toLineProtocol(timePrecision?: TimeUnitV2 | undefined | null, defaultTags?: Record<string, string> | undefined | null): string | null
}
export declare class PointValues {
get measurement(): string | null
get timestamp(): number | null
setTimestamp(time: number): void
constructor(measurement: string)
static fromMeasurement(measurement: string): PointValues
getTag(tagName: string): string | null
setTag(tagName: string, tagValue: string): void
removeTag(tagName: string): void
get tagNames(): Array<string>
getFloatField(name: string): number | null
setFloatField(name: string, value: number): void
getIntField(name: string): number | null
setIntField(name: string, value: number): void
getUintegerField(name: string): number | null
setUintegerField(name: string, value: number): void
getStringField(name: string): string | null
setStringField(name: string, value: string): void
getBooleanField(name: string): boolean | null
setBooleanField(name: string, value: boolean): void
getFieldType(name: string): PointFieldType | null
getField(name: string, expectedType?: PointFieldType | undefined | null): any | null
setField(name: string, value: any, fieldType?: PointFieldType | undefined | null): void
setFields(values: Record<string, any>): void
removeField(name: string): void
getFieldNames(): Array<string>
hasFields(): boolean
}
export interface FlightOptions {
keepAliveInterval?: number
keepAliveTimeout?: number
}
export type LibraryReturnType =
Record<string, any | undefined | null>
export type PointFieldType = 'float'|
'integer'|
'uinteger'|
'string'|
'boolean';
export type PointFieldValue =
| { type: 'Float', field0: number }
| { type: 'Integer', field0: number }
| { type: 'UInteger', field0: number }
| { type: 'String', field0: string }
| { type: 'Boolean', field0: boolean }
export type Precision =
| { type: 'V2', field0: TimeUnitV2 }
| { type: 'V3', field0: TimeUnitV3 }
export interface QueryPayload {
database: string
query: string
type?: QueryType
params?: Record<string, string>
}
export type QueryType = 'sql'|
'influxql'|
'flight_sql';
export type ReturnDataType =
Record<string, any | undefined | null>
export type Serializer = 'unsafe'|
'library'|
'raw';
export type TimeUnitV2 = /** Time in seconds. */
's'|
/** Time in milliseconds. */
'ms'|
/** Time in microseconds. */
'us'|
/** Time in nanoseconds. */
'ns';
export type TimeUnitV3 = /** Time in seconds. */
'second'|
/** Time in milliseconds. */
'millisecond'|
/** Time in microseconds. */
'microsecond'|
/** Time in nanoseconds. */
'nanosecond';
export interface WriteOptions {
/** Precision to use in writes for timestamp. default ns */
precision?: Precision
/** HTTP headers that will be sent with every write request */
headers?: Record<string, string>
/** When specified, write bodies larger than the threshold are gzipped */
gzip: boolean
/** * Instructs the server whether to wait with the response until WAL persistence completes.
* noSync=true means faster write but without the confirmation that the data was persisted.
*
* Note: This option is supported by InfluxDB 3 Core and Enterprise servers only.
* For other InfluxDB 3 server types (InfluxDB Clustered, InfluxDB Clould Serverless/Dedicated)
* the write operation will fail with an error.
*
* Default value: false. */
noSync?: boolean
defaultTags?: Record<string, string>
}