opengauss.js

1.1.3 • Public • Published

opengauss.js

npm version
Non-blocking OpenGauss/PostgreSQL client for Node.js with pure JavaScript implementation.

A hybrid database client that supports both OpenGauss and PostgreSQL connections simultaneously, based on:

✅ ​Key Features

  • Dual-database support with type switching
  • Compatibility with Knex.js and other query builders
  • Native promise-based API
  • Connection pooling support
  • Enables smooth transition of existing Knex.js applications from PostgreSQL to OpenGauss with schema compatibility

Installation

npm install opengauss.js

Usage

Basic Client Setup Configuration

const { Client } = require("opengauss.js");

const client = new Client({
    // Base configuration (inherited from node-postgres)
    user: 'dbuser',
    password: 'secretpassword',
    host: 'database.server.com',
    port: 3211,
    database: 'mydb',

    // Key parameter [required]
    databaseType: 'openGauss'  // Options: 'openGauss' | 'postgre' | 'pg' (Default: 'openGauss')
});

Integration with Knex.js

Seamless replacement via npm alias:

// package.json
{
    ...,
    "dependencies": {
        "pg": "npm:opengauss.js@^1.1.0"
    }
}

Knex configuration

const knex = require('knex')({
  client: 'pg',
  connection: {
    databaseType: 'openGauss',  // Specify database type
    // ...other standard pg configurations
    host: '127.0.0.1',
  },
  version: "9.2"
});

Readme

Keywords

Package Sidebar

Install

npm i opengauss.js

Weekly Downloads

1

Version

1.1.3

License

MIT

Unpacked Size

124 kB

Total Files

26

Last publish

Collaborators

  • heyauri