Entity class for ClayDB
$ npm install clay-entity --save'use strict'
const clayEntity = require('clay-entity')
{
let entity01 = clayEntity({
title: 'Wonderful Banana'
})
console.log(entity01)
}Entity class for ClayDB
- Functions
DecoratedEntityClass
Create a Entity instance
| Param | Type | Description |
|---|---|---|
| args | * |
Decorate an entity
| Param | Type | Description |
|---|---|---|
| decorate | Entity |
Detect a instance is entity or not
| Param | Type | Description |
|---|---|---|
| obj | * | Object to check |
Constructor of DecoratedEntity class
| Param | Type | Description |
|---|---|---|
| entity | Entity | Entity to decorate |
Get entity attribute.
| Param | Type | Description |
|---|---|---|
| name | string | Name of attribute |
Set value
| Param | Type | Description |
|---|---|---|
| name | string | Name of attribute to set |
| value | * | Value to set |
Set values
| Param | Type | Description |
|---|---|---|
| attributes | Object | Attributes to set |
| options | Object | Optional settings |
| options.allowReserved | boolean | Allow to set reserved |
Set $$at attribute
| Param | Type | Description |
|---|---|---|
| at | Date | Date data set at |
Get $$at attribute
Set $$by attribute
| Param | Type | Description |
|---|---|---|
| by | string | Lump id |
Get $$by attribute
Seal this entity
| Param | Type | Description |
|---|---|---|
| privateKey | string | Private key to seal |
Get seal
Set resource name as as
| Param | Type | Description |
|---|---|---|
| as | string | As |
Get as
Set entity number as num
| Param | Type | Description |
|---|---|---|
| num | string | As |
Get num
Verify the entity with public key
| Param | Type | Description |
|---|---|---|
| publicKey | string |
Convert into value object
This software is released under the Apache-2.0 License.
