bfx-hf-models-adapter-template
v1.0.1
Published
HF DB adapter template
Downloads
3
Maintainers
Readme
Bitfinex Honey Framework DB Adapter Template for Node.JS
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
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request