1.3.7 • Published 4 years ago

keyv-extensions v1.3.7

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Keyv-Extensions .github/workflows/build.yml

Adds functionality and sub content to keyv

Introduction

The idea for this is to have proxy arrays and keyv stores that will allow you to save array or another keyv database inside a keyv database

Examples

Proxy Array

Creating a array linked to a database and adding test value

const keyvExt = require('keyv-extensions');
const arr = keyvExt.keyvArray(keyv, 'arr');
arr[0] = 'test';

Sub Keyv

Creating a sub keyv and setting values

const keyvExt = require('keyv-extensions');
const sub = new Keyv({store: new keyvExt(keyv, 'sub')});
sub.set('test', 'testvalue');

Documentation

Classes

Functions

KeyvSub

A Keyv store, so you can put a keyv db inside another keyv db

Kind: global class

new KeyvSub(database, key)

ParamTypeDescription
databaseKeyvThe database to put the key in
keystringKey name

Example

var sub = new Keyv({store: new KeyvSub(db, 'data')})

keyvSub.get(key) ⇒ Promise.<any>

Gets a value

Kind: instance method of KeyvSub
Returns: Promise.<any> - The value

ParamType
keystring

keyvSub.set(key, value) ⇒ Promise.<true>

Sets a key to some value

Kind: instance method of KeyvSub
Returns: Promise.<true> - True if it was succesfull

ParamType
keystring
valueany

keyvSub.delete(key) ⇒ Promise.<boolean>

Deletets a value

Kind: instance method of KeyvSub
Returns: Promise.<boolean> - True if it exists and false if not

ParamType
keystring

keyvSub.clear() ⇒ Promise.<true>

Clears the database

Kind: instance method of KeyvSub
Returns: Promise.<true> - True if it was succesfull

keyvArray(database, key, arr) ⇒ Promise.<Array>

Creates a array inside a keyv database

Kind: global function
Returns: Promise.<Array> - Promise with the array

ParamTypeDescription
databaseKeyvThe database to put the array in
keystringThe key the array will be stored in
arrArrayThe array to create on
1.3.7

4 years ago

1.3.6

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.2

4 years ago