Skip to main content

deno-database

A database package to use in deno

Usage

Command

Having the location parameter is required for this package to work

deno run --location http://localhost <other parameters> <file>

Code

import { Database } from 'https://deno.land/x/deno_database/index.ts'

const database = new Database()

await database.set('test', 'hello world')

await database.get('test') // --> "hello world"

await database.has('test') // --> true

await database.delete('test')

await database.has('test') // --> false

await database.push('array', 'hello')
await database.push('array', 'world')

await database.get('array') // --> ["hello", "world"]

await database.add('number', 3)
await database.subtract('number', 1)

await database.get('number') // --> 2

await database.all() // --> [ { key: "number", value: 2 }, { key: "array", value: [ "hello", "world" ] } ]

await database.clear()

await database.all() // --> []