Skip to content

Record (NodeJS)

Dmitry Kochin edited this page Jun 22, 2018 · 1 revision

Record is the class to represent a database record.


Creating record

let record = new Record(tablespace, table);

Creates empty record from tablespace and table

Arguments

  • tablespace - name of the record tablespace
  • table - name of the record table

Adding field

record.putField(field);

Put field value to record

Arguments


Adding field by binary value

record.putValue(name, value, type);

Puts field value using its binary representation

Arguments

  • name - name of the field
  • value - Buffer object (binary value)
  • type - type of the field

Bulk adding fields

record.putFields(fields, types);

Puts several field values at once

Arguments

  • fields - an object with keys - field names and values - field values
  • types - an object with keys - field names and values - the corresponding field type

Adding field by value

record.putValue(name, value, type);

Puts field value using its binary representation

Arguments

  • name - name of the field
  • value - the field value
  • type - type of the field

Adding hash of the field

record.putHash(name, hash, type);

Puts field hash into record. When field is not changed it is possible to supply its hash instead of the value.

Arguments

  • name - name of the field
  • hash - Buffer object containing field hash
  • type - type of the field

Getting field value

let field = record.getField(name);

Gets field with the specified name from the record

Arguments

  • name - name of the field

Returns

Field or null


Getting all fields

let fields = record.fields;

Gets and object with keys - field names and values - Field objects

Returns

object with keys - field names and values - Field objects

Clone this wiki locally