Hypertable Client Library / Exports / HypRecord
Class: HypRecord
A Hypertable record available to consumers of the client library.
Method calls make requests across the client library sandbox boundary.
Implements
ClientLibRecord
Table of contents
Properties
Methods
- createdAtDate
- createdByUser
- delete
- readField
- readFieldByKey
- readFieldOpt
- reload
- save
- setField
- setFieldByKey
- updatedAtDate
- updatedByUser
Properties
collectionId
• Readonly collectionId: string
The unique ID of the collection to which this record belongs
Implementation of
ClientLibRecord.collectionId
createdAt
• Readonly createdAt: string
The timestamp when this record was created (as an ISO 8601 string)
Implementation of
ClientLibRecord.createdAt
createdBy
• Readonly createdBy: string
The ID of the user who created this record
Implementation of
ClientLibRecord.createdBy
fieldValues
• Readonly fieldValues: Object
The field values of this record, as pairs of: field ID -> field value
For example:
// The value of FIELD_ID
const value = record.fieldValues[FIELD_ID];
// The list of values of FIELD_ID_2
const values = records.map(r => r.fieldValues[FIELD_ID_2]);
See also the readField() method.
Index signature
▪ [fieldId: string]: string
Implementation of
ClientLibRecord.fieldValues
id
• Readonly id: string
The unique ID of the record
Implementation of
ClientLibRecord.id
title
• Readonly title: string
Implementation of
ClientLibRecord.title
updatedAt
• Readonly updatedAt: string
The timestamp when this record was last updated (as an ISO 8601 string)
Implementation of
ClientLibRecord.updatedAt
updatedBy
• Readonly updatedBy: string
The ID of the user who last updated this record
Implementation of
ClientLibRecord.updatedBy
Methods
createdAtDate
▸ createdAtDate(): Date
The createdAt timestamp as a Date object
Returns
Date
createdByUser
▸ createdByUser(): Promise<{ colour: string ; id: string ; image: string ; name: string }>
More information about the user who created the record
Returns
Promise<{ colour: string ; id: string ; image: string ; name: string }>
delete
▸ delete(): Promise<boolean>
Delete this record from the database
Returns
Promise<boolean>
readField
▸ readField(field): undefined | string
Read the value of the specified field, either specifying the field's ID or using an object received from a HypCollection.
throws An error if the specified field was not found
Parameters
| Name | Type | Description |
|---|---|---|
field |
string | HypField |
The ID of the field, or a HypField object |
Returns
undefined | string
The value of the specified field
readFieldByKey
▸ readFieldByKey(fieldKey): undefined | string
Read the value of the field with the given key
Parameters
| Name | Type | Description |
|---|---|---|
fieldKey |
string |
The key of the field to read |
Returns
undefined | string
The value of the field, may be undefined if the field was not found
readFieldOpt
▸ readFieldOpt(field): undefined | string
Use readField instead
Read the value of the specified field, either specifying the field's ID or using an object received from a HypCollection.
deprecated
Parameters
| Name | Type | Description |
|---|---|---|
field |
string | HypField |
The ID of the target field, or a HypField object |
Returns
undefined | string
The value of the specified field, or undefined if the field was not found
reload
▸ reload(): Promise<boolean>
Reload this record from the database, undoing any edits
Returns
Promise<boolean>
save
▸ save(): Promise<boolean>
Save all edits to this record to the database
Returns
Promise<boolean>
setField
▸ setField(field, value): void
Set the value of the specified field
Parameters
| Name | Type | Description |
|---|---|---|
field |
string | HypField |
The target field either as an ID or a HypField from a HypCollection |
value |
string |
The new value as a string |
Returns
void
setFieldByKey
▸ setFieldByKey(fieldKey, value): boolean
Set the value of the field with the given key
Parameters
| Name | Type | Description |
|---|---|---|
fieldKey |
string |
The key of the field to update |
value |
string |
The new value as a string |
Returns
boolean
true if the value was set, false if the field was not found
updatedAtDate
▸ updatedAtDate(): Date
The updatedAt timestamp as a Date object
Returns
Date
updatedByUser
▸ updatedByUser(): Promise<{ colour: string ; id: string ; image: string ; name: string }>
More information about the user who created the record
Returns
Promise<{ colour: string ; id: string ; image: string ; name: string }>