Global
This class is global

Constructor

new

Encoder

(Number protocolVersion, ClientOptions options)

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

Parameters:
Name Type Description
protocolVersion Number
options ClientOptions

Methods

decode

(Buffer buffer, Object 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 Object

An object containing the data type code and info.

type.code Number

Type code.

type.info optional Object

Additional information on the type for complex / nested types.

encode

(* value, [Object, String or Number typeInfo])

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 Description
value *

The value to be converted.

typeInfo optional Object, String or Number

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.
Returns:
Type Description
Buffer