Class: Encoder

Encoder(protocolVersion, options)

Serializes and deserializes to and from a CQL type and a Javascript Type.

Constructor

new Encoder(protocolVersion, options)

Parameters:
Name Type Description
protocolVersion Number
options ClientOptions
Source:

Methods

decode(buffer, type)

Decodes Cassandra bytes into Javascript values.

This is part of an experimental API, this can be changed future releases.

Parameters:
Name Type Description
buffer Buffer

Raw buffer to be decoded.

type ColumnInfo
Source:

encode(value, typeInfoopt) → {Buffer|null|undefined}

Encodes Javascript types into Buffer according to the Cassandra protocol.

This is part of an experimental API, this can be changed future releases.

Parameters:
Name Type Attributes Description
value *

The value to be converted.

typeInfo Object | String | Number <optional>

The type information.

It can be either a:

  • A String representing the data type.
  • A Number with one of the values of dataTypes.
  • An Object containing the type.code as one of the values of dataTypes and type.info.
Source:
Throws:

When there is an encoding error

Type
TypeError
Returns:

Returns null for null values, undefined for unset values and buffer for all other values.

Type
Buffer | null | undefined