Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Interact with CovenantSQL via proxy in web and node

License

NotificationsYou must be signed in to change notification settings

CovenantSQL/cql-js-driver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repo is javascript lib to interact withCovenantSQL local proxy.

Install

Installcql-js-driver via npm or yarn:

npm install --save cql-js-driver

or

yarn add cql-js-driver

Get started

Follow CovenantSQLQuickStart to get you prepared.

use testnet proxy directly

We provides testnet proxy for your testing:http(s)://testnet-proxy.covenantsql.io

constconfig={endpoint:'http://testnet-proxy.covenantsql.io',dbid:`${DB_ID}`,// your DB id created by `cql` tools in QuickStart}

if you setup your own proxy

  1. set up CovenantSQL local proxy
$ go get github.com/CovenantSQL/CovenantSQL$ make bin/cql$ rsync -avP ./conf/testnet/{config.yaml,private.key}~/.cql/$ ./bin/cql -adapter 127.0.0.1:11105
  1. fill in the configs
constconfig={endpoint:'127.0.0.1:11105',// local testnet endpoint without httpsdbid:`${DB_ID}`,// your DB id created by `cql` tools}

connect and query

importcqlfrom'cql-js-driver'constconfig={...}// see abovecql.createConnection(config).then(async(connection:any)=>{// readconstdata1=awaitconnection.query("select ? + ?",[2.1,3.2]);console.log(data1);// writeconstcreateTableSQL=`    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    );    `conststatus1=awaitconnection.exec(createTableSQL)console.log(`exec1 status:`,status1);constdata2=awaitconnection.query("show tables;");console.log(data2);}).catch((e:any)=>console.log(e))

Contribution

  • yarn dev
  • openhttp://localhost:8080/examples/

License

Apache-2.0.

About

Interact with CovenantSQL via proxy in web and node

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp