Module

Gun

Package
purescript-gun
Repository
timdeputter/purescript-gun

The Gun module provides a basic wrapper for gun.js database. see https://gun.eco for details about the gun database.

#GunDb Source

data GunDb :: Type

Represents a reference to a gundb instance.

Instances

#GunChainCtx Source

data GunChainCtx :: Type

Basic datastructure to chain gun operations like 'put', 'set' or 'once'

#User Source

data User :: Type

An authenticated user for a gundb instance

Instances

#syncWithPeer Source

syncWithPeer :: String -> Effect GunDb

Creates a new gun database instance, and syncs the data with the given peer.

#syncWithPeers Source

syncWithPeers :: Array String -> Effect GunDb

Creates a new gun database instance, and syncs the data with the given peers.

#offline Source

offline :: Effect GunDb

Creates a new local gun database instance, without syncing with any peers.

#Getable Source

class Getable a b  where

A Typeclass which allows getting data from different sources.

The get function takes a path either as a String or as an Array of Strings and returns a GunChainCtx. get can be called on a GunDb instance or a User

Members

Instances

#put Source

put :: forall a. a -> GunChainCtx -> Effect GunChainCtx

Save data into gun, syncing it with your connected peers.

#once Source

once :: forall a b. GunChainCtx -> Aff (Maybe { data :: a, key :: b })

Get the current data without subscribing to updates. Or Nothing if it cannot be found.

#on Source

on :: forall a b. GunChainCtx -> Aff { data :: a, key :: b }

Subscribe to updates and changes on a node or property in realtime.

#set Source

set :: GunChainCtx -> GunChainCtx -> Effect GunChainCtx

Add a unique item to an unordered list.

#map Source

map :: forall a b. (a -> b) -> GunChainCtx -> GunChainCtx

Map iterates over each property and item on a node, passing it down the chain, transforming the data with the given function. It also subscribes to every item as well and listens for newly inserted items.

#filter Source

filter :: forall a. (a -> Boolean) -> GunChainCtx -> GunChainCtx

Filter iterates over each property and item on a node, passing it down the chain, filtering the data with the given function. It also subscribes to every item as well and listens for newly inserted items.

#each Source

each :: GunChainCtx -> GunChainCtx

Each iterates over each property and item on a node, passing it down the chain. It also subscribes to every item as well and listens for newly inserted items.

Modules
Gun
Gun.Sea