Socket
Socket
Sign inDemoInstall

just-sql-query-builder

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.2

5

package.json
{
"name": "just-sql-query-builder",
"version": "1.0.0",
"version": "1.0.2",
"author": "Uldis Jansons <uj@mobilly.lv>",

@@ -32,3 +32,2 @@ "license": "APLv2",

},
"keywords": [

@@ -48,2 +47,2 @@ "sql",

]
}
}

76

README.md

@@ -1,3 +0,4 @@

# simple-sql-query-builder
Simple SQL query builder
# Just a simple SQL query builder
Simple library to help with creating reusable SQL queries independent from DB.
- helps create reusable SQL queries

@@ -8,6 +9,9 @@ - extensible

# Usage example
## SELECT
```typescript
import { SelectQueryBuilder } from 'simple-sql-query-builder';
const jsqb = require('just-sql-query-builder');
const qb = new SelectQueryBuilder('test_table');
const qb = new jsqb.SelectQueryBuilder('test_table');
qb.andCondition('field1 = ?', [10]);

@@ -35,1 +39,65 @@ qb.groupResultsBy('group_field');

## UPDATE
```typescript
const jsqb = require('just-sql-query-builder');
const qb = new jsqb.UpdateQueryBuilder('test_table');
qb.addValue('field1', 'foo');
qb.andCondition('field3 = ?', [30]);
qb.setLimit(10);
console.log('Query: ' + qb.buildAndGetQuery());
console.log('Params: ' + qb.getConditionParams());
```
**Result "Query: "**
```sql
UPDATE test_table SET field1 = ? WHERE field3 = ? LIMIT 10
```
**Result "Params: "**
```sql
['foo', 30]
```
## DELETE
```typescript
const jsqb = require('just-sql-query-builder');
const qb = new jsqb.DeleteQueryBuilder('test_table');
qb.andCondition('field1 = ?', ['foo']);
console.log('Query: ' + qb.buildAndGetQuery());
console.log('Params: ' + qb.getConditionParams());
```
**Result "Query: "**
```sql
DELETE FROM test_table WHERE field1 = ?
```
**Result "Params: "**
```sql
['foo']
```
## INSERT
```typescript
const jsqb = require('just-sql-query-builder');
const qb = new InsertQueryBuilder('test_table', ['field1', 'field2']);
console.log('Query: ' + qb.buildAndGetQuery());
console.log('Params: ' + qb.getConditionParams());
```
**Result "Query: "**
```sql
INSERT INTO test_table (field1,field2) VALUES (?,?)
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc