swc-storage
TypeScript icon, indicating that this package has built-in type declarations

0.0.10 • Public • Published

swc-storage

Storage is a wrapper for accessing database using NodeJS. It's written in TypeScript and provides basic functions to fetch data from the database, insert, delete and modify data. Currently only MySQL is supported but more will follow soon.

Adapters

Since every database has to be accessed differntly, Storage has an adapter for each database-type e.g. MySQL-adapter. You can create an instance of an adapter directly or get it using the static function getStorage provided by the Storage module. This function takes a hash and returns an Adapter-object. For more information on adapters and the functions they provide read into the index.adoc inside the docs directory.

Connection

During the lifetime of an adapter it holds the connection to the database open. This can lead to problems if the database server is configured to close unused connection after some time. This problem can easily be solved by not creating an adapter directly but using a connection instead. The connection object is instantiated using a config-hash similar to that that has to be passed to the getStorage-function. The connection ensures that only one adapter is open at a time and that it is closed as soon as it is not used anymore. Read more on connections in connections.adoc inside the docs directory.

Readme

Keywords

none

Package Sidebar

Install

npm i swc-storage

Weekly Downloads

0

Version

0.0.10

License

ISC

Unpacked Size

33.6 kB

Total Files

25

Last publish

Collaborators

  • tlaub