4.0.17 • Published 5 years ago

clay-driver-json v4.0.17

Weekly downloads
215
License
Apache-2.0
Repository
github
Last release
5 years ago

clay-driver-json

Build Status npm Version JS Standard

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

create(args) -> JSONDriver

Create driver instance

ParamTypeDescription
args*

JSONDriver Class

Driver to store data into json files

Extends:

  • Driver

new JSONDriver(dirname, options)

Constructor of JSONDriver class

ParamTypeDescription
dirnamestringDirectory name to save data
optionsObjectOptional settings
options.flashIntervalnumberInterval of auto flush

driver.flush() -> Promise

Flush data into json files

driver.one(resourceName, id) -> Promise.<ClayEntity>

Get single entity from resource

ParamTypeDescription
resourceNamestringName of resource
idClayIdResource id

driver.list(resourceName, condition) -> Promise.<ClayCollection>

List entities from resource

ParamTypeDescription
resourceNamestringName of resource
conditionListConditionList condition query

driver.create(resourceName, attributes) -> Promise.<ClayEntity>

Create a new entity with resource

ParamTypeDescription
resourceNamestringName of resource
attributesObjectResource attributes to create

driver.update(resourceName, id, attributes) -> Promise.<ClayEntity>

Update an existing entity in resource

ParamTypeDescription
resourceNamestringName of resource
idClayIdResource id
attributesObjectResource attributes to update

driver.destroy(resourceName, id) -> Promise.<number>

Delete a entity resource

ParamTypeDescription
resourceNamestringName of resource
idClayIdResource id

driver.drop(resourceName) -> Promise.<boolean>

Drop resource

ParamTypeDescription
resourceNamestringName of resource

driver.resources() -> Promise.<Resource>

List resources

License

This software is released under the Apache-2.0 License.

Links

4.0.17

5 years ago

4.0.16

5 years ago

4.0.15

5 years ago

4.0.14

6 years ago

4.0.13

6 years ago

4.0.12

6 years ago

4.0.11

6 years ago

4.0.9

6 years ago

4.0.8

6 years ago

4.0.7

6 years ago

4.0.6

6 years ago

4.0.5

6 years ago

4.0.4

6 years ago

4.0.3

7 years ago

4.0.2

7 years ago

4.0.1

7 years ago

3.0.3

7 years ago

3.0.2

7 years ago

3.0.1

7 years ago