Skip to content

Commit 0ddeeaa

Browse files
committed
Rename project from Squongo to QueryLeaf
1 parent 7b2a7b5 commit 0ddeeaa

File tree

8 files changed

+59
-38
lines changed

8 files changed

+59
-38
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Run Tests
1+
name: QueryLeaf Tests
22

33
on:
44
push:

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Squongo
1+
# QueryLeaf
22

3-
SQL to MongoDB command compiler for NodeJS.
3+
SQL to MongoDB query translator for NodeJS.
44

55
## Overview
66

7-
Squongo is a library that translates SQL queries into MongoDB commands. It parses SQL using node-sql-parser, transforms it into an abstract command set, and then executes those commands against the MongoDB Node.js driver.
7+
QueryLeaf is a library that translates SQL queries into MongoDB commands. It parses SQL using node-sql-parser, transforms it into an abstract command set, and then executes those commands against the MongoDB Node.js driver.
88

99
## Features
1010

@@ -25,35 +25,35 @@ Squongo is a library that translates SQL queries into MongoDB commands. It parse
2525
## Installation
2626

2727
```bash
28-
npm install squongo
28+
npm install queryleaf
2929
```
3030

3131
## Usage
3232

3333
```typescript
34-
import { createSquongo } from 'squongo';
34+
import { createQueryLeaf } from 'queryleaf';
3535

3636
async function main() {
37-
// Create a Squongo instance
38-
const squongo = createSquongo('mongodb://localhost:27017', 'mydatabase');
37+
// Create a QueryLeaf instance
38+
const queryLeaf = createQueryLeaf('mongodb://localhost:27017', 'mydatabase');
3939

4040
try {
4141
// Basic SQL query
42-
const basicResults = await squongo.execute('SELECT * FROM users WHERE age > 21');
42+
const basicResults = await queryLeaf.execute('SELECT * FROM users WHERE age > 21');
4343
console.log('Basic query results:', basicResults);
4444

4545
// Query with nested fields
46-
const nestedResults = await squongo.execute('SELECT name, address.city, address.zip FROM users WHERE address.country = "USA"');
46+
const nestedResults = await queryLeaf.execute('SELECT name, address.city, address.zip FROM users WHERE address.country = "USA"');
4747
console.log('Nested fields query results:', nestedResults);
4848

4949
// Query with array access
50-
const arrayResults = await squongo.execute('SELECT order_id, items[0].name, items[0].price FROM orders WHERE items[0].price > 100');
50+
const arrayResults = await queryLeaf.execute('SELECT order_id, items[0].name, items[0].price FROM orders WHERE items[0].price > 100');
5151
console.log('Array access query results:', arrayResults);
5252
} catch (error) {
5353
console.error('Error executing query:', error);
5454
} finally {
5555
// Close the MongoDB connection when done
56-
await squongo.close();
56+
await queryLeaf.close();
5757
}
5858
}
5959

TODO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Squongo Project TODO List
1+
# QueryLeaf Project TODO List
22

33
## Integration Tests to Add
44

package.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "squongo",
2+
"name": "queryleaf",
33
"version": "0.1.0",
4-
"description": "SQL to MongoDB command compiler",
4+
"description": "SQL to MongoDB query translator",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
77
"scripts": {
@@ -21,6 +21,14 @@
2121
],
2222
"author": "",
2323
"license": "AGPL-3.0",
24+
"repository": {
25+
"type": "git",
26+
"url": "git+https://github.com/beekeeper-studio/queryleaf.git"
27+
},
28+
"bugs": {
29+
"url": "https://github.com/beekeeper-studio/queryleaf/issues"
30+
},
31+
"homepage": "https://github.com/beekeeper-studio/queryleaf#readme",
2432
"dependencies": {
2533
"mongodb": "^6.14.2",
2634
"node-sql-parser": "^4.11.0"

src/__tests__/integration/test-setup.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { MongoTestContainer, loadFixtures, testUsers, testProducts, testOrders } from '../utils/mongo-container';
2-
import { createSquongo } from '../../index';
2+
import { createQueryLeaf } from '../../index';
33
import { Db } from 'mongodb';
44

55
/**
66
* Base test setup for integration tests
77
*/
88
export class IntegrationTestSetup {
99
public mongoContainer: MongoTestContainer;
10-
public TEST_DB = 'squongo_test';
10+
public TEST_DB = 'queryleaf_test';
1111
public connectionString: string = '';
1212

1313
constructor() {
@@ -43,10 +43,10 @@ export class IntegrationTestSetup {
4343
}
4444

4545
/**
46-
* Create a new Squongo instance
46+
* Create a new QueryLeaf instance
4747
*/
4848
getSquongo() {
49-
return createSquongo(this.connectionString, this.TEST_DB);
49+
return createQueryLeaf(this.connectionString, this.TEST_DB);
5050
}
5151
}
5252

src/examples/basic-usage.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
import { createSquongo } from '../index';
1+
import { createQueryLeaf } from '../index';
22

33
/**
4-
* Example showing basic usage of Squongo
4+
* Example showing basic usage of QueryLeaf
55
*/
66
async function main() {
77
// Connection info for MongoDB
88
const connectionString = 'mongodb://localhost:27017';
99
const dbName = 'example';
1010

11-
// Create a Squongo instance
12-
const squongo = createSquongo(connectionString, dbName);
11+
// Create a QueryLeaf instance
12+
const queryLeaf = createQueryLeaf(connectionString, dbName);
1313

1414
try {
1515
// Setup sample data with nested structures and arrays
1616
console.log('\nSetting up sample data with nested structures and arrays...');
1717

18-
await squongo.execute(`
18+
await queryLeaf.execute(`
1919
INSERT INTO users (_id, name, age, email, active, address) VALUES
2020
('101', 'Nested User', 30, '[email protected]', true, {
2121
"street": "123 Main St",
@@ -25,7 +25,7 @@ async function main() {
2525
})
2626
`);
2727

28-
await squongo.execute(`
28+
await queryLeaf.execute(`
2929
INSERT INTO orders (_id, userId, items, total) VALUES
3030
('201', '101', [
3131
{ "id": "item1", "name": "Laptop", "price": 1200 },
@@ -89,15 +89,15 @@ async function main() {
8989
for (const sql of queries) {
9090
console.log(`\nExecuting SQL: ${sql}`);
9191
try {
92-
const result = await squongo.execute(sql);
92+
const result = await queryLeaf.execute(sql);
9393
console.log('Result:', JSON.stringify(result, null, 2));
9494
} catch (error) {
9595
console.error('Error:', error instanceof Error ? error.message : String(error));
9696
}
9797
}
9898
} finally {
9999
// Close the MongoDB connection when done
100-
await squongo.close();
100+
await queryLeaf.close();
101101
}
102102
}
103103

src/index.ts

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@ import {
44
SqlParser,
55
SqlCompiler,
66
CommandExecutor,
7-
Squongo
7+
Squongo as QueryLeaf
88
} from './interfaces';
99
import { SqlParserImpl } from './parser';
1010
import { SqlCompilerImpl } from './compiler';
1111
import { MongoExecutor } from './executor';
1212

1313
/**
14-
* Squongo implementation
14+
* QueryLeaf implementation
1515
*/
16-
class SquongoImpl implements Squongo {
16+
class QueryLeafImpl implements QueryLeaf {
1717
private parser: SqlParser;
1818
private compiler: SqlCompiler;
1919
private executor: CommandExecutor;
2020

2121
/**
22-
* Create a new Squongo instance
22+
* Create a new QueryLeaf instance
2323
* @param parser SQL parser
2424
* @param compiler SQL compiler
2525
* @param executor Command executor
@@ -76,17 +76,29 @@ class SquongoImpl implements Squongo {
7676
}
7777

7878
/**
79-
* Create a new Squongo instance
79+
* Create a new QueryLeaf instance
8080
* @param connectionString MongoDB connection string
8181
* @param dbName Database name
82-
* @returns Squongo instance
82+
* @returns QueryLeaf instance
8383
*/
84-
export function createSquongo(connectionString: string, dbName: string): Squongo {
84+
export function createQueryLeaf(connectionString: string, dbName: string): QueryLeaf {
8585
const parser = new SqlParserImpl();
8686
const compiler = new SqlCompilerImpl();
8787
const executor = new MongoExecutor(connectionString, dbName);
8888

89-
return new SquongoImpl(parser, compiler, executor);
89+
return new QueryLeafImpl(parser, compiler, executor);
90+
}
91+
92+
/**
93+
* Create a new Squongo instance - alias for createQueryLeaf for backwards compatibility
94+
* @deprecated Use createQueryLeaf instead
95+
* @param connectionString MongoDB connection string
96+
* @param dbName Database name
97+
* @returns QueryLeaf instance
98+
*/
99+
export function createSquongo(connectionString: string, dbName: string): QueryLeaf {
100+
console.warn("Warning: createSquongo is deprecated, use createQueryLeaf instead");
101+
return createQueryLeaf(connectionString, dbName);
90102
}
91103

92104
// Export interfaces and implementation classes
@@ -96,11 +108,12 @@ export {
96108
SqlParser,
97109
SqlCompiler,
98110
CommandExecutor,
99-
Squongo,
111+
QueryLeaf,
112+
Squongo, // For backwards compatibility
100113
SqlParserImpl,
101114
SqlCompilerImpl,
102115
MongoExecutor,
103-
SquongoImpl
116+
QueryLeafImpl
104117
};
105118

106119
// Re-export interfaces

src/interfaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export interface CommandExecutor {
107107
}
108108

109109
/**
110-
* Main Squongo interface
110+
* Main QueryLeaf interface
111111
*/
112112
export interface Squongo {
113113
execute(sql: string): Promise<any>;

0 commit comments

Comments
 (0)