Hypertable Client Library / Exports / HypCollection

Class: HypCollection

A collection in a Hypertable project.

Properties of the collection can be read, and methods to interacting with records within the collection are provided.

Implements

Table of contents

Properties

Accessors

Methods

Properties

description

Readonly description: string

The longer description of the collection

Implementation of

ClientLibCollection.description


fields

Readonly fields: HypField[]

The list of definitions of fields of every record in the collection

Implementation of

ClientLibCollection.fields


id

Readonly id: string

The ID of the collection

Implementation of

ClientLibCollection.id


name

Readonly name: string

The name of the collection

Implementation of

ClientLibCollection.name


titleFieldId

Readonly titleFieldId: string

The ID of the "title" field for records in this collection. The "title" field can be used to find a user-friendly "name" for each record in the collection.

Implementation of

ClientLibCollection.titleFieldId

Accessors

titleField

get titleField(): HypField

The field definition of the "title" field. The "title" field can be used to find a user-friendly "name" for each record in the collection.

Example:

const title = myRecord.readField(myCollection.titleField);

Returns

HypField

Methods

createRecord

createRecord(): Promise<undefined | HypRecord>

Create and return a new empty record in the collection.

Returns

Promise<undefined | HypRecord>

The created record, or undefined if the operation was not successful


deleteAllRecords

deleteAllRecords(): Promise<boolean>

Delete all the records in the collection

TODO! Not implemented

Returns

Promise<boolean>


findRecord

findRecord(id): Promise<undefined | HypRecord>

Find the record with the given ID

Parameters

Name Type Description
id string The ID of the desired record

Returns

Promise<undefined | HypRecord>

The desired record, or undefined if the record was not found


findRecords

findRecords(how): Promise<HypRecord[]>

Find a number of records by <what?>

Parameters

Name Type Description
how any ?

Returns

Promise<HypRecord[]>


getAllRecords

getAllRecords(): Promise<HypRecord[]>

Get All records from this collection (May only return a page in some circumstances)

Returns

Promise<HypRecord[]>

All the records in the collection


getField

getField(fieldName): undefined | HypField

Read the field with the given name

Parameters

Name Type Description
fieldName string The name of the desired field

Returns

undefined | HypField

The desired field, or undefined if the field was not found


getFieldById

getFieldById(fieldId): undefined | HypField

Read the field with the given ID

Parameters

Name Type Description
fieldId string The ID of the desired field

Returns

undefined | HypField

The desired field, or undefined if the field was not found


getFieldByKey

getFieldByKey(fieldKey): undefined | HypField

Read the field with the given key

Parameters

Name Type Description
fieldKey string The key of the desired field

Returns

undefined | HypField

The desired field, or undefined if the field was not found


getRecord

getRecord(id): Promise<HypRecord>

Read the record with the given ID

throws Throws an error if the record was not found

Parameters

Name Type Description
id string The ID of the desired record

Returns

Promise<HypRecord>

The desired record


toJson

toJson(): ClientLibCollection

Get this collection as a serialisable JSON object

Returns

ClientLibCollection