Home Reference Source Test
public class | source

Store

class Store is the primitive class for composing higher storage class. This class wrap levelup for connect with abstract-leveldown compliant stores.

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

levelup: *

public

logger: *

Method Summary

Public Methods
public

async connect()

public

async delItem(key: String ): Promise

Delete item given the item key

public

async getItem(key: String , asBuffer: boolean): Object

Get item given the key

public

async getItemList(namePrefix: String ): Array

Get the current items under the prefix path

public

makeCheckItemNameFn(pattern: String ): Function

Make name maching function based on prefix path

public

async setItem(key: String , data: Object ): Promise

Set new item with the given key and value

Public Constructors

public constructor() source

Public Members

public levelup: * source

public logger: * source

Public Methods

public async connect() source

public async delItem(key: String ): Promise source

Delete item given the item key

Params:

NameTypeAttributeDescription
key String

key name to delete

Return:

Promise

deleted key promise

public async getItem(key: String , asBuffer: boolean): Object source

Get item given the key

Params:

NameTypeAttributeDescription
key String

key name

asBuffer boolean
  • optional
  • default: false

return object or buffer array, default object

Return:

Object

item object

public async getItemList(namePrefix: String ): Array source

Get the current items under the prefix path

Params:

NameTypeAttributeDescription
namePrefix String

Return:

Array

list of item names

public makeCheckItemNameFn(pattern: String ): Function source

Make name maching function based on prefix path

Params:

NameTypeAttributeDescription
pattern String

prefix name

Return:

Function

name matching function

public async setItem(key: String , data: Object ): Promise source

Set new item with the given key and value

Params:

NameTypeAttributeDescription
key String

key name of item

data Object

value of item

Return:

Promise

new key promise