File tree Expand file tree Collapse file tree 6 files changed +85
-13
lines changed Expand file tree Collapse file tree 6 files changed +85
-13
lines changed Original file line number Diff line number Diff line change 22 "files.associations" : {
33 "*.ifc" : " ifc" ,
44 "*.json" : " json" ,
5- "string" : " cpp"
5+ "string" : " cpp" ,
6+ "vector" : " cpp" ,
7+ "memory" : " cpp" ,
8+ "ostream" : " cpp" ,
9+ "__bit_reference" : " cpp" ,
10+ "__hash_table" : " cpp" ,
11+ "__locale" : " cpp" ,
12+ "__node_handle" : " cpp" ,
13+ "__split_buffer" : " cpp" ,
14+ "__threading_support" : " cpp" ,
15+ "__verbose_abort" : " cpp" ,
16+ "array" : " cpp" ,
17+ "bitset" : " cpp" ,
18+ "cctype" : " cpp" ,
19+ "clocale" : " cpp" ,
20+ "cmath" : " cpp" ,
21+ "complex" : " cpp" ,
22+ "cstdarg" : " cpp" ,
23+ "cstddef" : " cpp" ,
24+ "cstdint" : " cpp" ,
25+ "cstdio" : " cpp" ,
26+ "cstdlib" : " cpp" ,
27+ "cstring" : " cpp" ,
28+ "ctime" : " cpp" ,
29+ "cwchar" : " cpp" ,
30+ "cwctype" : " cpp" ,
31+ "deque" : " cpp" ,
32+ "execution" : " cpp" ,
33+ "initializer_list" : " cpp" ,
34+ "ios" : " cpp" ,
35+ "iosfwd" : " cpp" ,
36+ "istream" : " cpp" ,
37+ "limits" : " cpp" ,
38+ "locale" : " cpp" ,
39+ "mutex" : " cpp" ,
40+ "new" : " cpp" ,
41+ "optional" : " cpp" ,
42+ "print" : " cpp" ,
43+ "queue" : " cpp" ,
44+ "ratio" : " cpp" ,
45+ "sstream" : " cpp" ,
46+ "stack" : " cpp" ,
47+ "stdexcept" : " cpp" ,
48+ "streambuf" : " cpp" ,
49+ "string_view" : " cpp" ,
50+ "tuple" : " cpp" ,
51+ "typeinfo" : " cpp" ,
52+ "unordered_map" : " cpp" ,
53+ "variant" : " cpp" ,
54+ "algorithm" : " cpp"
655 }
756}
Original file line number Diff line number Diff line change 9999 console . log ( "\nCrossDB Simulation Complete." ) ;
100100 db . close ( ) ;
101101 console . log ( "Database connection closed." ) ;
102+ const version = db . version ( )
103+ console . log ( "CroosDB version: " , version ) ;
104+
102105}
Original file line number Diff line number Diff line change 11// Import the 'bindings' module to link the compiled native addon 'crossdb'
2- const crossdb = require ( 'bindings' ) ( 'crossdb' ) ; // Link the compiled addon
2+ const crossdb = require ( 'bindings' ) ( 'crossdb' ) ; // Link the compiled addon
33
44// Define the CrossDB class to manage database operations
55class CrossDB {
@@ -9,6 +9,7 @@ class CrossDB {
99 */
1010 constructor ( dbPath ) {
1111 this . conn = new crossdb . Connection ( dbPath ) ; // Create a new connection to the database
12+ this . pkgVersion = require ( './package.json' ) . version ;
1213 }
1314
1415 /**
@@ -40,13 +41,24 @@ class CrossDB {
4041 commit ( ) {
4142 this . conn . commit ( ) ; // Commit the transaction
4243 }
43-
44- /**
45- * Rollsback the current transaction
46- */
47- rollback ( ) {
48- this . conn . rollback ( ) ; // Rollback the transaction
49- }
44+
45+ /**
46+ * Rollsback the current transaction
47+ */
48+ rollback ( ) {
49+ this . conn . rollback ( ) ; // Rollback the transaction
50+ }
51+
52+ /**
53+ * Get CroosDB version
54+ */
55+ version ( ) {
56+ return {
57+ "CroosDB" : this . conn . version ( ) , // Get CroosDB version
58+ "Package" : this . pkgVersion , // Node.js package version
59+ "Platform" : process . platform // Platform information
60+ } ;
61+ }
5062}
5163
5264// Export the CrossDB class as a module
Original file line number Diff line number Diff line change 11{
22 "name" : " @croosdb/crossdb-nodejs" ,
3- "version" : " 1.3.1 " ,
3+ "version" : " 1.4.0 " ,
44 "main" : " index.js" ,
55 "author" : " Efrem Ropelato" ,
66 "contributors" :[
Original file line number Diff line number Diff line change @@ -30,7 +30,8 @@ class Connection : public Napi::ObjectWrap<Connection>
3030 InstanceMethod (" close" , &Connection::Close),
3131 InstanceMethod (" begin" , &Connection::Begin),
3232 InstanceMethod (" commit" , &Connection::Commit),
33- InstanceMethod (" rollback" , &Connection::Rollback)});
33+ InstanceMethod (" rollback" , &Connection::Rollback),
34+ InstanceMethod (" version" , &Connection::Version)});
3435
3536 exports.Set (" Connection" , func);
3637 return exports;
@@ -174,6 +175,13 @@ class Connection : public Napi::ObjectWrap<Connection>
174175 }
175176 return info.Env ().Null ();
176177 }
178+
179+ Napi::Value Version (const Napi::CallbackInfo &info)
180+ {
181+ Napi::Env env = info.Env ();
182+ std::string vv = xdb_version ();
183+ return Napi::String::New (env, vv);
184+ }
177185};
178186
179187Napi::Object InitAll (Napi::Env env, Napi::Object exports)
You can’t perform that action at this time.
0 commit comments