kern-orm 0.8.0 → 0.10.0
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 +5 -5
- package/dist/db/node-postgres.d.mts +1 -0
- package/dist/db/node-postgres.mjs +2 -0
- package/dist/db/postgres-js.d.mts +1 -0
- package/dist/db/postgres-js.mjs +2 -0
- package/dist/db/types.d.mts +1 -0
- package/dist/db/types.mjs +2 -0
- package/dist/db.d.mts +1 -0
- package/dist/db.mjs +2 -0
- package/dist/{index-B1aH5Ht0.d.mts → index-aiyU5HR5.d.mts} +84 -561
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +4040 -4
- package/dist/testing.d.mts +1 -26
- package/dist/testing.mjs +2 -693
- package/dist/{text-CIUxPWPl.mjs → text-ucmJCsCN.mjs} +49 -92
- package/dist/types.d.mts +3 -3
- package/dist/types.mjs +62 -2
- package/package.json +10 -3
- package/dist/driver-error-Dx5R83Rp.mjs +0 -5010
- package/dist/types-D3d35qR2.mjs +0 -239
package/README.md
CHANGED
|
@@ -9,18 +9,18 @@ See the [documentation](https://ilyasemenov.github.io/kern-orm/).
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
npm install kern-orm
|
|
12
|
+
npm install kern-orm postgres
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
See [Getting Started](https://ilyasemenov.github.io/kern-orm/getting-started) for the supported runtimes, TypeScript, and PostgreSQL versions.
|
|
15
|
+
See [Getting Started](https://ilyasemenov.github.io/kern-orm/orm/getting-started) for the supported runtimes, TypeScript, and PostgreSQL versions.
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
19
19
|
Describe the tables and their relations, then load forms with their fields in one SQL statement, and insert a form with its fields in a transaction:
|
|
20
20
|
|
|
21
21
|
```ts
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
22
|
+
import { bindSchema, createDatabase, defineSchema, defineTable, many } from "kern-orm"
|
|
23
|
+
import { postgresJsDriver } from "kern-orm/db/postgres-js"
|
|
24
24
|
import * as t from "kern-orm/types"
|
|
25
25
|
import postgres from "postgres"
|
|
26
26
|
|
|
@@ -45,7 +45,7 @@ const schema = defineSchema({ form, field }).$relations({
|
|
|
45
45
|
const database = createDatabase({
|
|
46
46
|
driver: postgresJsDriver(postgres(process.env.DATABASE_URL!)),
|
|
47
47
|
})
|
|
48
|
-
const db =
|
|
48
|
+
const db = bindSchema(schema, database)
|
|
49
49
|
|
|
50
50
|
const forms = await db.form
|
|
51
51
|
.where({ published: true })
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "kern-db/node-postgres";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "kern-db/postgres-js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "kern-db/types";
|
package/dist/db.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "kern-db";
|
package/dist/db.mjs
ADDED