Skip to content
Base driver for ClasyDB
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ci
doc
example
lib
test
.LICENSE.bud
.README.md.bud
.gitignore
.npmignore
.travis.yml
LICENSE
README.md
jsdoc.json
package-lock.json
package.json

README.md

clay-driver-base

Build Status npm Version JS Standard

Base driver for clay

Installation

$ npm install clay-driver-base --save

Usage

'use strict'

const {Driver} = require('clay-driver-base')

// Define custom driver
class MyDriver extends Driver {
  one (namespace, id) { /* ... */ }

  list (namespace, condition) { /* ... */ }

  create (namespace, attributes) { /* ... */ }

  update (namespace, id, attributes) { /* ... */ }

  destroy (namespace, id) { /* ... */ }

}

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

For more detail, see API Guide

API

clay-driver-base@4.1.6

Base driver for clay

Functions

create(args) -> Driver

Create driver instance

Param Type Description
args *

Driver Class

Abstract driver

new Driver()

Constructor of Driver class

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

You can’t perform that action at this time.