Home Reference Source Test
public class | source

StorageManager

Constructor Summary

Public Constructor
public

constructor(db: *, storageName: *, version: number)

Member Summary

Public Members
public

db: *

public

Method Summary

Public Methods
public

Delete a entry from the database for a given key.

public

get(key: string): Promise

Get a entry value from the database for a given key.

public

Get a entry version from the database for a given key.

public

set(key: string, version: string, value: *): Promise

Adds a new entry to the database for a given key, together with its version.

Public Constructors

public constructor(db: *, storageName: *, version: number) source

Params:

NameTypeAttributeDescription
db *
storageName *
version number
  • optional
  • default: 1

Public Members

public db: * source

public storageName: * source

Public Methods

public delete(key: string): Promise source

Delete a entry from the database for a given key.

Params:

NameTypeAttributeDescription
key string
  • nullable: false

key that was stored using storageManager.set

Return:

Promise

result - Promise that will be fulfilled with the number of affected rows.

public get(key: string): Promise source

Get a entry value from the database for a given key. If no entry is found undefined is returned.

Params:

NameTypeAttributeDescription
key string
  • nullable: false

key that was stored using storageManager.set

Return:

Promise

result - Promise that will be fulfilled with the value.

public getVersion(key: string): Promise source

Get a entry version from the database for a given key. If no entry is found undefined is returned.

Params:

NameTypeAttributeDescription
key string
  • nullable: false

key that was stored using storageManager.set

Return:

Promise

result - Promise that will be fulfilled with the version.

public set(key: string, version: string, value: *): Promise source

Adds a new entry to the database for a given key, together with its version. If an entry for the given key is already stored in the database, it will be updated.

Params:

NameTypeAttributeDescription
key string
  • nullable: false

key that can be used with storageManager.get to retrieve the value object

version string
  • nullable: false

version descriptor for the given value

value *

value stored in the database that is mapped to given key

Return:

Promise

result - Promise that will be fulfilled with the key if the entry was stored successfully, otherwise it is rejected with an error.