-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from farmer00317558/main
add darwin-arm64 prebuild & typescript definitions
- Loading branch information
Showing
7 changed files
with
59 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
node_modules | ||
build | ||
/metadata | ||
/user_defined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
const addon = require('.'); | ||
const db = new addon.db('CSV') | ||
const addon = require("."); | ||
const db = new addon.db("CSV"); | ||
var result; | ||
|
||
// Test query | ||
result = db.query("SELECT version()"); | ||
console.log(result) | ||
console.log(result); | ||
|
||
// Test session | ||
db.session("CREATE FUNCTION IF NOT EXISTS hello AS () -> 'chDB'"); | ||
result = db.session("SELECT hello()", "TabSeparated"); | ||
console.log(result) | ||
|
||
console.log(result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
declare interface ChdbModule { | ||
Execute(query: string, format: string): string; | ||
Session(query: string, format: string, path: string): string; | ||
} | ||
|
||
declare const chdb: ChdbModule; | ||
|
||
declare interface DB { | ||
format: string; | ||
path: string; | ||
query(query: string, format?: string): string; | ||
session(query: string, format?: string, path?: string): string; | ||
} | ||
|
||
declare interface DBFactory { | ||
(format?: string, path?: string): DB; | ||
new (format?: string, path?: string): DB; | ||
} | ||
|
||
declare const db: DBFactory; | ||
|
||
export { chdb, db }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,28 @@ | ||
const addon = require('.'); | ||
const addon = require("."); | ||
var res; | ||
|
||
addon.Session("CREATE DATABASE IF NOT EXISTS db_xxx Engine=Atomic;", "CSV", ".") | ||
addon.Session("CREATE TABLE IF NOT EXISTS db_xxx.log_table_xxx (x String, y Int) ENGINE = Log;", "CSV", ".") | ||
addon.Session("INSERT INTO db_xxx.log_table_xxx VALUES ('a', 1), ('b', 3), ('c', 2), ('d', 5);", "CSV", ".") | ||
res = addon.Session("SELECT * FROM db_xxx.log_table_xxx LIMIT 4;", "Pretty", ".") | ||
console.log(res); | ||
addon.Session( | ||
"CREATE DATABASE IF NOT EXISTS db_xxx Engine=Atomic;", | ||
"CSV", | ||
"." | ||
); | ||
|
||
addon.Session( | ||
"CREATE TABLE IF NOT EXISTS db_xxx.log_table_xxx (x String, y Int) ENGINE = Log;", | ||
"CSV", | ||
"." | ||
); | ||
|
||
addon.Session( | ||
"INSERT INTO db_xxx.log_table_xxx VALUES ('a', 1), ('b', 3), ('c', 2), ('d', 5);", | ||
"CSV", | ||
"." | ||
); | ||
|
||
res = addon.Session( | ||
"SELECT * FROM db_xxx.log_table_xxx LIMIT 4;", | ||
"Pretty", | ||
"." | ||
); | ||
|
||
console.log(res); |