QuestDB Node.js Client - v4.0.2
    Preparing search index...

    Class SenderBufferV2

    Buffer implementation for protocol version 2.
    Sends floating point numbers in binary form, and provides support for arrays.

    Hierarchy

    • SenderBufferBase
      • SenderBufferV2
    Index

    Constructors

    Properties

    buffer: Buffer
    position: number
    log: Logger

    Methods

    • Resets the buffer, data sitting in the buffer will be lost.
      In other words it clears the buffer, and sets the writing position to the beginning of the buffer.

      Returns SenderBuffer

      Returns with a reference to this buffer.

    • Parameters

      • pos: number = ...

      Returns Buffer

      Returns a cropped buffer, or null if there is nothing to send.
      The returned buffer is backed by this buffer instance, meaning the view can change as the buffer is mutated. Used only in tests to assert the buffer's content.

    • Parameters

      • pos: number = ...

      Returns Buffer

      Returns a cropped buffer ready to send to the server, or null if there is nothing to send.
      The returned buffer is a copy of this buffer. It also compacts the buffer.

    • Writes the table name into the buffer.

      Parameters

      • table: string

        Table name.

      Returns SenderBuffer

      Returns with a reference to this buffer.

    • Writes a symbol name and value into the buffer.
      Use it to insert into SYMBOL columns.

      Parameters

      • name: string

        Symbol name.

      • value: unknown

        Symbol value, toString() is called to extract the actual symbol value from the parameter.

      Returns SenderBuffer

      Returns with a reference to this buffer.

    • Writes a string column with its value into the buffer.
      Use it to insert into VARCHAR and STRING columns.

      Parameters

      • name: string

        Column name.

      • value: string

        Column value, accepts only string values.

      Returns SenderBuffer

      Returns with a reference to this buffer.

    • Writes a boolean column with its value into the buffer.
      Use it to insert into BOOLEAN columns.

      Parameters

      • name: string

        Column name.

      • value: boolean

        Column value, accepts only boolean values.

      Returns SenderBuffer

      Returns with a reference to this buffer.

    • Writes a 64-bit signed integer into the buffer.
      Use it to insert into LONG, INT, SHORT and BYTE columns.

      Parameters

      • name: string

        Column name.

      • value: number

        Column value, accepts only number values.

      Returns SenderBuffer

      Returns with a reference to this buffer.

      Error if the value is not an integer

    • Writes a timestamp column with its value into the buffer.
      Use it to insert into TIMESTAMP columns.

      Parameters

      • name: string

        Column name.

      • value: number | bigint

        Epoch timestamp, accepts numbers or BigInts.

      • Optionalunit: TimestampUnit = "us"

        Timestamp unit. Supported values: 'ns' - nanoseconds, 'us' - microseconds, 'ms' - milliseconds. Defaults to 'us'.

      Returns SenderBuffer

      Returns with a reference to this buffer.

    • Closes the row after writing the designated timestamp into the buffer.

      Parameters

      • timestamp: number | bigint

        Designated epoch timestamp, accepts numbers or BigInts.

      • Optionalunit: TimestampUnit = "us"

        Timestamp unit. Supported values: 'ns' - nanoseconds, 'us' - microseconds, 'ms' - milliseconds. Defaults to 'us'.

      Returns void

    • Closes the row without writing designated timestamp into the buffer.
      Designated timestamp will be populated by the server on this record.

      Returns void

    • Returns the current position of the buffer.
      New data will be written into the buffer starting from this position.

      Returns number

    • Checks if the buffer has sufficient capacity for additional data and resizes if needed.

      Parameters

      • data: string[]

        Array of strings to calculate the required capacity for

      • base: number = 0

        Base number of bytes to add to the calculation

      Returns void

    • Writes a 64-bit floating point value into the buffer using v2 serialization (binary format).
      Use it to insert into DOUBLE or FLOAT database columns.

      Parameters

      • name: string

        Column name.

      • value: number

        Column value, accepts only number values.

      Returns SenderBuffer

      Returns with a reference to this buffer.

    • Write an array column with its values into the buffer using v2 format.

      Parameters

      • name: string

        Column name

      • value: unknown[]

        Array values to write (currently supports double arrays)

      Returns SenderBuffer

      Returns with a reference to this buffer.

      Error if array validation fails:

      • value is not an array
      • or the shape of the array is irregular: the length of sub-arrays are different
      • or the array is not homogeneous: its elements are not all the same type