bfx-hf-models-adapter-template

1.0.1 • Public • Published

Bitfinex Honey Framework DB Adapter Template for Node.JS

Build Status

This repo serves as a template for creating new database adapters for the honey framework. All adapters must implement the methods broken out here, and provide a custom initialisation function. This system enables the use of the Honey Framework with multiple database backends. The only requirement for valid adapters is that all method signatures remain the same, and all return values are promises that resolve to the standardized values. All methods are asynchronous.

Features

  • Provides a template enumerating all required methods for bfx-hf-models compatibility

Installation

npm i --save bfx-hf-models-adapter-template

Quickstart & Example

Although the resulting DB instance is useless as it does not have an actual DB backend to write/read data, the following example illustrates how to pass an adapter to a bfx-hf-models instance:

const HFDBTemplateAdapter = require('bfx-hf-models-adapter-template')
const { schema: HFDBBitfinexSchema } = require('bfx-hf-ext-plugin-bitfinex')
const HFDB = require('bfx-hf-models')

const db = new HFDB({
  schema: HFDBBitfinexSchema,
  adapter: HFDBTemplateAdapter()
})

// db is now a valid bfx-hf-models database instance

Docs

Refer to the examples/ folder for executable examples. For information on the available model methods, check the documentation for bfx-hf-models or refer to docs/requirements.md for a specification of what a valid adapter must provide.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Package Sidebar

Install

npm i bfx-hf-models-adapter-template

Weekly Downloads

2

Version

1.0.1

License

Apache-2.0

Unpacked Size

13.6 kB

Total Files

33

Last publish

Collaborators

  • bitfinexorg