https://github.com/shadowtime2000/energydb
Key value database for Deno
https://github.com/shadowtime2000/energydb
database deno hacktoberfest javascript typescript typescript-library
Last synced: about 1 month ago
JSON representation
Key value database for Deno
- Host: GitHub
- URL: https://github.com/shadowtime2000/energydb
- Owner: shadowtime2000
- License: mit
- Created: 2020-10-06T02:12:09.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-07T15:39:50.000Z (over 5 years ago)
- Last Synced: 2025-11-20T02:19:21.833Z (7 months ago)
- Topics: database, deno, hacktoberfest, javascript, typescript, typescript-library
- Language: TypeScript
- Homepage: https://deno.land/x/energydb
- Size: 9.77 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
energydb
key: string value: anydatabase
## CDN
You can use [denopkg](https://denopkg.com/shadowtime2000/energydb) or `deno.land/x`
### Usage
```typescript
import EnergyDB from "https://denopkg.com/shadowtime2000/energydb/mod.ts";
const db = new EnergyDB();
await db.set("foo", "bar");
await db.get("foo"); // "bar"
await db.delete("foo");
```
#### Custom Stores
Stores must fit the interface under `mod/store.ts` and store factories must fit the interface under `mod/storeFactory.ts`.
```typescript
const storeFactory = () => new Map(); // Replace with your own store
const db = new EnergyDB(storeFactory);
```
#### Adapters
By default the database is stored in memory but `EnergyDB` still supports database adapters. They must fit the interface under `mod/adapter.ts` and you can register them as so:
```typescript
const db = new EnergyDB();
db.registerAdapter(new MyAdapter());
```
##### Supported Adapters
- A `sqlite` adapter located under `mod/adapter/sqlite.ts`