Clarify api docs for all databases

This commit is contained in:
haad 2023-06-30 09:59:39 +03:00
parent faa312363e
commit c1b0359605
4 changed files with 17 additions and 8 deletions

View File

@ -15,6 +15,8 @@
* const options = { indexBy: 'myCustomId'}
* const Partial = Documents(options)
* const documents = await Partial({ ipfs })
*
* @augments module:Databases~Database
*/
import Database from '../database.js'
@ -23,7 +25,7 @@ const DefaultOptions = { indexBy: '_id' }
/**
* Defines a Documents database.
* @param {Object} options Various options for configuring the Document store.
* @param {string} [params.indexBy=_id] An index.
* @param {string} [options.indexBy=_id] An index.
* @return {module:Databases.Databases-Documents} A Documents function.
* @memberof module:Databases
*/
@ -86,7 +88,7 @@ const Documents = ({ indexBy } = DefaultOptions) => async ({ ipfs, identity, add
*
* The findFn function's signature takes the form `function(doc)` where doc
* is a document's value property. The function should return true if the
* document is found, false otherwise.
* document should be included in the results, false otherwise.
* @return {Array} Found documents.
* @memberof module:Databases.Databases-Documents
* @instance

View File

@ -1,7 +1,10 @@
/**
* @namespace Databases-Events
* @memberof module:Databases
* @description Events database.
* @description
* Events database is an immutable, append-only event log database.
*
* @augments module:Databases~Database
*/
import Database from '../database.js'

View File

@ -2,9 +2,9 @@
* @namespace Databases-KeyValueIndexed
* @memberof module:Databases
* @description
* KeyValueIndexed database.
* Key-Value database that uses an index in order to provide fast queries.
*
* Key/value pairs are stored to the configured storage.
* Key-value pairs are stored to the configured storage.
* @example <caption>Specify a custom storage</caption>
* import { create } from 'IPFS'
*
@ -12,6 +12,9 @@
* const storage = await IPFSBlockStorage()
* const Partial = KeyValueIndexed({ storage })
* const keyValueIndexed = await Partial({ ipfs })
*
* @augments module:Databases~Database
* @augments module:Databases.Databases-KeyValue
*/
import KeyValue from './keyvalue.js'
import LevelStorage from '../storage/level.js'
@ -21,8 +24,6 @@ const valueEncoding = 'json'
/**
* Defines a KeyValueIndexed database.
* @param {Object} options Various options for configuring the KeyValueIndexed
* store.
* @param {module:Storage} [storage=LevelStorage] A compatible storage where
* the key/value pairs are indexed.
* @return {module:Databases.Databases-KeyValueIndexed} A KeyValueIndexed

View File

@ -1,7 +1,10 @@
/**
* @namespace Databases-KeyValue
* @memberof module:Databases
* @description KeyValue database.
* @description
* Key-Value database.
*
* @augments module:Databases~Database
*/
import Database from '../database.js'