@trust0/ridb-level
v1.1.0
Published
Level DB wrapper for @trust0/ridb.
Downloads
1,397
Readme
Description
This package is a leveldb wrapper for the ridb database.
Installation & usage (typescript)
npm install @trust0/ridb @trust0/ridb-level -S
Using yarn:
yarn add @trust0/ridb @trust0/ridb-level
Usage
The following example demonstrates how to create a database with a leveldb storage engine and a simple schema with ID primary key as string.
import { RIDB, SchemaFieldType, Doc } from '@trust0/ridb';
import { LevelDB } from '@trust0/ridb-level';
const db = new RIDB(
{
dbName: "test",
schemas: {
demo: {
version: 0,
primaryKey: 'id',
type: SchemaFieldType.object,
properties: {
id: {
type: SchemaFieldType.string,
maxLength: 60
}
}
}
} as const
}
)
await db.start({
storageType: LevelDB,
password: "test"
});