Base driver for clay
$ npm install clay-driver-base --save
'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
Base driver for clay
- Functions
Driver
Class
Create driver instance
Param | Type | Description |
---|---|---|
args | * |
Abstract driver
Constructor of Driver class
Get single entity from resource
Param | Type | Description |
---|---|---|
resourceName | string | Name of resource |
id | ClayId | Resource id |
options | Object | Options settings |
List entities from resource
Param | Type | Description |
---|---|---|
resourceName | string | Name of resource |
condition | ListCondition | List condition query |
options | Object | Options settings |
Create a new entity with resource
Param | Type | Description |
---|---|---|
resourceName | string | Name of resource |
attributes | Object | Resource attributes to create |
Update an existing entity in resource
Param | Type | Description |
---|---|---|
resourceName | string | Name of resource |
id | ClayId | Resource id |
attributes | Object | Resource attributes to update |
Delete a entity resource
Param | Type | Description |
---|---|---|
resourceName | string | Name of resource |
id | ClayId | Resource id |
Drop resource
Param | Type | Description |
---|---|---|
resourceName | string | Name of resource |
List resources
This software is released under the Apache-2.0 License.