sedentary-pg 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -0
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -33,6 +33,34 @@
|
|
|
33
33
|
|
|
34
34
|
The **PostgreSQL** specilized package of [Sedentary](https://www.npmjs.com/package/sedentary).
|
|
35
35
|
|
|
36
|
+
# Usage
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
import { SedentaryPG } from "sedentary-pg";
|
|
40
|
+
|
|
41
|
+
const db = new SedentaryPG(/* PG connection */);
|
|
42
|
+
|
|
43
|
+
class Items extends db.model("Item", {
|
|
44
|
+
num: db.INT,
|
|
45
|
+
str: db.VARCHAR(30)
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
(async function () {
|
|
49
|
+
await db.connect();
|
|
50
|
+
|
|
51
|
+
const item = Items.create();
|
|
52
|
+
|
|
53
|
+
item.num = 0;
|
|
54
|
+
item.str = "0";
|
|
55
|
+
|
|
56
|
+
await item.save();
|
|
57
|
+
|
|
58
|
+
const records = await Items.load({});
|
|
59
|
+
|
|
60
|
+
console.log(records); // [{ id: 1, num: 0, str: "0" }]
|
|
61
|
+
})();
|
|
62
|
+
```
|
|
63
|
+
|
|
36
64
|
# Installation
|
|
37
65
|
|
|
38
66
|
With [npm](https://www.npmjs.com/package/sedentary-pg):
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Daniele Ricci <daniele.icc@gmail.com> (https://github.com/iccicci)",
|
|
3
3
|
"bugs": "https://github.com/iccicci/sedentary-pg/issues",
|
|
4
|
+
"contributors": [
|
|
5
|
+
"Daniele Ricci <daniele.icc@gmail.com> (https://github.com/iccicci)",
|
|
6
|
+
"yossarian <sergiybiluk@gmail.com> (https://github.com/captain-yossarian)"
|
|
7
|
+
],
|
|
4
8
|
"dependencies": {
|
|
5
9
|
"pg": "8.7.1",
|
|
6
10
|
"pg-format": "1.0.4",
|
|
7
|
-
"sedentary": "0.0.
|
|
11
|
+
"sedentary": "0.0.22"
|
|
8
12
|
},
|
|
9
13
|
"description": "The ORM which never needs to migrate - PostgreSQL",
|
|
10
14
|
"devDependencies": {
|
|
@@ -80,5 +84,5 @@
|
|
|
80
84
|
}
|
|
81
85
|
},
|
|
82
86
|
"types": "index.d.ts",
|
|
83
|
-
"version": "0.0.
|
|
87
|
+
"version": "0.0.22"
|
|
84
88
|
}
|