4.0.17 • Published 6 years ago
clay-driver-json v4.0.17
clay-driver-json
Clay driver to save data into JSON files
Installation
$ npm install clay-driver-json --save
Usage
'use strict'
const { JSONDriver } = require('clay-driver-memory')
{
const clayLump = require('clay-lump')
let lump01 = clayLump({
driver: new JSONDriver({})
})
/* ... */
}
API
clay-driver-json@4.0.16
Clay driver to save data into JSON files
- Functions
JSONDriver
Class
Functions
create(args) -> JSONDriver
Create driver instance
Param | Type | Description |
---|---|---|
args | * |
JSONDriver
Class
Driver to store data into json files
Extends:
Driver
new JSONDriver(dirname, options)
Constructor of JSONDriver class
Param | Type | Description |
---|---|---|
dirname | string | Directory name to save data |
options | Object | Optional settings |
options.flashInterval | number | Interval of auto flush |
driver.flush() -> Promise
Flush data into json files
driver.one(resourceName, id) -> Promise.<ClayEntity>
Get single entity from resource
Param | Type | Description |
---|---|---|
resourceName | string | Name of resource |
id | ClayId | Resource id |
driver.list(resourceName, condition) -> Promise.<ClayCollection>
List entities from resource
Param | Type | Description |
---|---|---|
resourceName | string | Name of resource |
condition | ListCondition | List condition query |
driver.create(resourceName, attributes) -> Promise.<ClayEntity>
Create a new entity with resource
Param | Type | Description |
---|---|---|
resourceName | string | Name of resource |
attributes | Object | Resource attributes to create |
driver.update(resourceName, id, attributes) -> Promise.<ClayEntity>
Update an existing entity in resource
Param | Type | Description |
---|---|---|
resourceName | string | Name of resource |
id | ClayId | Resource id |
attributes | Object | Resource attributes to update |
driver.destroy(resourceName, id) -> Promise.<number>
Delete a entity resource
Param | Type | Description |
---|---|---|
resourceName | string | Name of resource |
id | ClayId | Resource id |
driver.drop(resourceName) -> Promise.<boolean>
Drop resource
Param | Type | Description |
---|---|---|
resourceName | string | Name of resource |
driver.resources() -> Promise.<Resource>
List resources
License
This software is released under the Apache-2.0 License.
Links
4.0.17
6 years ago
4.0.16
6 years ago
4.0.15
6 years ago
4.0.14
7 years ago
4.0.13
7 years ago
4.0.12
7 years ago
4.0.11
7 years ago
4.0.9
7 years ago
4.0.8
7 years ago
4.0.7
8 years ago
4.0.6
8 years ago
4.0.5
8 years ago
4.0.4
8 years ago
4.0.3
8 years ago
4.0.2
8 years ago
4.0.1
8 years ago
3.0.3
8 years ago
3.0.2
8 years ago
3.0.1
8 years ago