- Notifications
You must be signed in to change notification settings - Fork2
orbitdb/set-db
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Set database type for OrbitDB.
$ pnpm add @orbitdb/set-dbAsSet database is like aFeed, but each value can only be present once. Works for primitive types as well as more complex objects.
A simple example withSet:
import{createOrbitDB}from"@orbitdb/core";import{registerSet}from"@orbitdb/set-db";// Register set database type. IMPORTANT - must call before creating orbit instance !registerSet();constorbitdb=awaitcreateOrbitDB({ ipfs})constdb=awaitorbitdb.open({type:"set"});awaitdb.add(1);awaitdb.add(2);constall=awaitdb.all();// [1, 2]awaitdb.add(1);awaitdb.all()// Yay !! Still [1, 2]
As more complex example with object types:
import{createOrbitDB}from"@orbitdb/core";import{registerSet}from"@orbitdb/set-db";// Register set database type. IMPORTANT - must call before creating orbit instance !registerSet();constorbit=awaitcreateOrbitDB({ ipfs})constdb=awaitorbitdb.open({type:"set"});awaitdb.add({a:1});awaitdb.add({a:2});constall=awaitdb.all();// [{a: 1}, {a: 2}]awaitdb.add({a:1});awaitdb.all()// Yay !! Still [{a: 1}, {a: 2}]
About
Set database for orbit-db
Resources
License
Code of conduct
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.