@hyperjumptech/db-connection-checker
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

@hyperjumptech/db-connection-checker

A Node.js library for checking database connection

Installation

npm i @hyperjumptech/db-connection-checker

Database Supports

  1. MariaDB
  2. MongoDB
  3. Postgres
  4. Redis

API

CheckConnectionOptions

type CheckConnectionOptions = {
  host?: string;
  port?: number;
  user?: string;
  password?: string;
  database?: string;
  timeout?: number;
};

MariaDB

checkMariaDBConnection(options?: CheckConnectionOptions): Promise<boolean>

Checks MariaDB connection.

import { checkMariaDBConnnection } from '@hyperjumptech/db-connection-checker';

const isConnected = await checkMariaDBConnnection();

MongoDB

checkMongoDBConnection(options?: CheckConnectionOptions): Promise<boolean>

Checks MongoDB connection.

import { checkMongoDBConnection } from '@hyperjumptech/db-connection-checker';

const isConnected = await checkMongoDBConnection();

Postgres

checkPostgresConnection(options?: CheckConnectionOptions): Promise<boolean>

Checks Postgres connection.

import { checkPostgresConnection } from '@hyperjumptech/db-connection-checker';

const isConnected = await checkPostgresConnection();

Redis

checkRedisConnection(options?: CheckConnectionOptions): Promise<boolean>

Checks Redis connection.

import { checkRedisConnection } from '@hyperjumptech/db-connection-checker';

const isConnected = await checkRedisConnection();

Acknowledgments

  1. mariadb-connector-nodejs
  2. node-mongodb-native
  3. node-postgres
  4. node-redis

License

MIT License

Copyright (c) 2022 Hyperjump Technology

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Package Sidebar

Install

npm i @hyperjumptech/db-connection-checker

Weekly Downloads

2

Version

0.0.2

License

MIT

Unpacked Size

8.79 kB

Total Files

6

Last publish

Collaborators

  • khermawan
  • nico-hyperjump
  • rafel
  • haricnugraha
  • budhi_npm
  • raosanfl
  • gregoryhyperjump
  • satriyopranoto
  • garychristianto