Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

database-adapter

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

database-adapter

An abstraction layer for database operation adapters

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

database-adapter NPM version pipeline status

An abstraction layer for database operation adapters

Why?

Databases are a great thing. They come in many different colors shapes with a lot of different features but also, most importantly, different query mechanisms and languages.

This module is supposed to make stuff easier (just like a lot of other modules).

What?

Its goal is to define an abstraction layer you can implement your database operations in without the need to worry about the hassle of rewriting your code in case you should ever want to change the kind of database you're using for your project.

This module is still in an early stage and some parts of the tech inside may still not be as configurable and cool as you'd want them to be. If you're interested, please take your time to contribute to this project!

(Other) developers (or you yourself) can create NPM modules that function as peer dependencies which define database adapters using the interface in here to make your code do what it's supposed to do.

One use-case could be reading the string-typed handle of database adapters from a config file, allowing you to (pseudo-)hotswap your database model by installing another adapter module and simply replacing its key (and configuration) in your config file!

By default the database adapter tries to connect to the database, validates its scheme against whatever you pass it in its configuration object and then returns its object for you to use. In case something goes wrong, it can try to reconnect or repair itself (which could also just be creating the datastore for file-based database models).

How?

This code is written in TypeScript. Using its typings and inheritance functionality allows you to define nice adapters for various database models.

The source code of this module has an example for the awesome LokiJS datastore attached (even though it also supports adapters itself).

- View example -

I also turned that example adapter into an NPM module.

Roadmap

There's still stuff to do! Please do not hesitate to contribute!

  • Add abstract methods for default operations like inserting or querying data.
  • Add the plugin infrastructure mentioned above

Keywords

FAQs

Package last updated on 15 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc