sequel-builder
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "sequel-builder", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Ported query library from php yii2 to nodejs. currently only supporting mysql.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -36,2 +36,19 @@ #Query Builder | ||
## Connection settings | ||
To open a connection. | ||
```javascript | ||
Query.connect({ | ||
"host": "xxxx", | ||
"user": "xxxx", | ||
"password": "xxxx", | ||
"database": "xxxx" | ||
}); | ||
``` | ||
To close the connection. | ||
```javascript | ||
Query.end(); | ||
``` | ||
## Building Queries | ||
@@ -49,3 +66,3 @@ To build a Query object, you call different query building methods to specify different parts of a SQL query. The names of these methods resemble the SQL keywords used in the corresponding parts of the SQL statement. For example, to specify the FROM part of a SQL query, you would call the from() method. All the query building methods return the query object itself, which allows you to chain multiple calls together. | ||
$query.select('id, email'); | ||
query.select('id, email'); | ||
``` | ||
@@ -107,7 +124,7 @@ | ||
```javascript | ||
$query->from(['public.user u', 'public.post p']); | ||
query.from(['public.user u', 'public.post p']); | ||
// equivalent to: | ||
$query->from('public.user u, public.post p'); | ||
query.from('public.user u, public.post p'); | ||
``` | ||
@@ -216,3 +233,3 @@ | ||
$query->where({'status': status}); | ||
query.where({'status': status}); | ||
@@ -219,0 +236,0 @@ if (search.length > 0) { |
74852
357