Was this page helpful?
Caution
You're viewing documentation for an unstable version of ScyllaDB Node.js Driver. Switch to the latest stable version.
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.
Parameters:
| Name | Type | Description |
|---|---|---|
buffer |
Buffer | Raw buffer to be decoded. |
type |
ColumnInfo |
Source
decodeRows(data, rowsNumber, columnNames, columnTypes) → {Array<Row>}
Decodes a whole page of results.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Buffer | |
rowsNumber |
number | |
columnNames |
Array<string> | |
columnTypes |
Array<{code: number}> |
Source
Returns:
- Type
- Array<Row>
encode(value, typeInfo) → {Buffer|null|undefined}
Encodes Javascript types into Buffer according to the Cassandra protocol.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
* | The value to be converted. |
typeInfo |
ColumnInfo | String | Number | null | The type information. It can be either a: |
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