2.0.4 • Published 6 years ago

clay-driver-localstorage v2.0.4

Weekly downloads
7
License
Apache-2.0
Repository
github
Last release
6 years ago

clay-driver-localstorage

Build Status npm Version JS Standard

LocalStorage driver for ClayDB

Installation

$ npm install clay-driver-localstorage --save

Usage

'use strict'

const LocalStorageDriver = require('clay-driver-localstorage')

{
  const clayLump = require('clay-lump')
  let lump01 = clayLump({
    driver: new LocalStorageDriver({})
  })
  /* ... */
}

API

clay-driver-localstorage@2.0.3

LocalStorage driver for ClayDB

Functions

create(args) -> LocalStorageDriver

Create a driver instance

ParamTypeDescription
args*

LocalStorageDriver Class

Driver to store data into local storages

Extends:

  • Driver

new LocalStorageDriver(dirname, options)

Constructor of LocalStorageDriver class

ParamTypeDescription
dirnamestringDirectory name to save data
optionsObjectOptional settings
options.prefixstringPrefix of key in local storage

driver.getStorage()

driver.delStorage()

driver.drop()

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

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

7 years ago