GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - CovenantSQL/node-covenantsql: NodeJS driver for CovenantSQL base on HTTP(s) proxy, now moved to =>

This repository was archived by the owner on Apr 1, 2019. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

17 Commits
17 Commits

Folders and files

NameName
Last commit message
Last commit date
dist
dist
 
 
examples
examples
 
 
src
src
 
 
test
test
 
 
.babelrc
.babelrc
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
rollup.config.ts
rollup.config.ts
 
 
tsconfig.json
tsconfig.json
 
 
yarn.lock
yarn.lock
 
 

Repository files navigation

node-covenantsql

Proxy version is build for both web and node environment, so now moved to covenantsql-proxy-js.


Coverage License

This repo is nodejs driver for CovenantSQL written by TypeScript.

Install

Install node-covenantsql via npm or yarn:

npm install --save node-covenantsql

or

yarn add node-covenantsql

Get started

Follow CovenantSQL Quickstart to get you prepared.

configs for driver

  • If the CovenantSQL endpoint comes with HTTPS then .pem and .key files are needed for requests:
const config = {
    endpoint: 'e.morenodes.com:11108', // testnet endpoint with https
    database: `${DB_ID}`, // your DB id created by `cql` tools
    key_dir: path.resolve(`${KEY_FILE_RELATIVE_PATH}`), // your key file
    https_pem_dir: path.resolve(`${PEM_FILE_RELATIVE_PATH}`) // your pem file (cert file)
}
  • If only HTTP is needed, then your config could be:
const config = {
    endpoint: 'localhost:11105', // local testnet endpoint without https
    database: `${DB_ID}`, // your DB id created by `cql` tools
    bypassPem: true // bypass https config
}

connect and query

import cql from 'node-covenantsql'

const config = {...} // see above

cql.createConnection(config).then(async (connection: any) => {
    // read
    const data1 = await connection.query("select ? + ?", [2.1, 3.2]);
    console.log(data1);
        
    // write
    const createTableSQL = `
    CREATE TABLE IF NOT EXISTS contacts (\
    contact_id INTEGER PRIMARY KEY,
    first_name TEXT NOT NULL,
    last_name TEXT NOT NULL,
    email text NOT NULL UNIQUE,
    phone text NOT NULL UNIQUE
    );
    `
    const status1 = await connection.exec(createTableSQL)
    console.log(`exec1 status:`, status1);

    const data2 = await connection.query("show tables;");
    console.log(data2);
}).catch((e: any) => console.log(e))

License

Apache-2.0.

About

NodeJS driver for CovenantSQL base on HTTP(s) proxy, now moved to =>

github.com/CovenantSQL/covenantsql-proxy-js

Topics

blockchaindatabase-drivernodejs-driversql

Resources

Readme
Apache-2.0 license
Activity
Custom properties

Stars

6 stars

Watchers

1 watching

Forks

3 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.