Skip to main content
Module

x/stowrage/mod.ts>Stowrage

Stowre all the thing's you like
Latest
class Stowrage
import { Stowrage } from "https://deno.land/x/stowrage@v0.4.2/mod.ts";

Stowrage class

Constructors

new
Stowrage(options?: StowrageOptions)

Type Parameters

optional
DataType = unknown

Properties

isPersistent: boolean
maxEntries: number | null
name: string | undefined
path: string

Methods

private
generateEntry(
name: string,
key: DataType,
override?: boolean,
init?: boolean,
): DataBase<DataType>
add(name: string, key: DataType): void

Add entry to db

close(): void

Close SQLite database if it exists

delete(name: string): void

Delete entry from db by name

deleteByID(id: number): void

Delete entry from db by ID

deleteByRange(start: number, length: number): void

Delete multiple entries from db

Delete the whole stowrage

ensure(name: string, value: DataType): DataBase<DataType>

Add entry to db and returns it aswell

fetch(name: string): DataBase<DataType>

Fetch entry by name

Fetch entry by ID

fetchByRange(start: number, length: number): DataBase<DataType>[]

Fetch multiple entries from db

Get an Array of entries that matches your filter

Get the first entry that matches your filter

has(name: string): boolean

Check if your stowrage has an entry with the given name

init(): Promise<void>

Initiate persistent storage Throw's when isPersistent = false

override(name: string, newValue: DataType): void

Override entry from db by name

overrideByID(id: number, key: DataType): void

Override entry from db by name

setValue(id: number, options: ChangeValueOptions<unknown>): void

Set the value of an entry via ID

setValue(name: string, options: ChangeValueOptions<unknown>): void

Set the value of an entry via ID

totalEntries(): number

Get total entries of the Stowrage