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.
#GunChainCtx Source
data GunChainCtx :: TypeBasic datastructure to chain gun operations like 'put', 'set' or 'once'
#syncWithPeer Source
syncWithPeer :: String -> Effect GunDbCreates a new gun database instance, and syncs the data with the given peer.
#syncWithPeers Source
syncWithPeers :: Array String -> Effect GunDbCreates a new gun database instance, and syncs the data with the given peers.
#Getable Source
class Getable a b whereA 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
get :: a -> b -> GunChainCtx
Instances
#put Source
put :: forall a. a -> GunChainCtx -> Effect GunChainCtxSave data into gun, syncing it with your connected peers.
#once Source
once :: forall b a. 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 b a. GunChainCtx -> Aff { data :: a, key :: b }Subscribe to updates and changes on a node or property in realtime.
#set Source
set :: GunChainCtx -> GunChainCtx -> Effect GunChainCtxAdd a unique item to an unordered list.
#map Source
map :: forall b a. (a -> b) -> GunChainCtx -> GunChainCtxMap 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 -> GunChainCtxFilter 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 -> GunChainCtxEach 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.