Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Set database for orbit-db

License

NotificationsYou must be signed in to change notification settings

orbitdb/set-db

Set database type for OrbitDB.

orbit-db-set testscodecov

Installation

$ pnpm add @orbitdb/set-db

Introduction

AsSet database is like aFeed, but each value can only be present once. Works for primitive types as well as more complex objects.

Examples

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

Stars

Watchers

Forks

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2026 Movatter.jp