@xata.io/drizzle 0.0.0-alpha.vf5fbc45 → 0.0.1
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/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +3 -3
- package/README.md +23 -9
- package/package.json +2 -2
package/.turbo/turbo-build.log
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
> @xata.io/drizzle@0.0.
|
2
|
+
> @xata.io/drizzle@0.0.1 build /home/runner/work/client-ts/client-ts/packages/plugin-client-drizzle
|
3
3
|
> rimraf dist && rollup -c
|
4
4
|
|
5
5
|
[36m
|
@@ -8,7 +8,7 @@
|
|
8
8
|
[90mhttps://rollupjs.org/troubleshooting/#warning-treating-module-as-external-dependency[39m
|
9
9
|
[1mdrizzle-orm[22m (imported by "src/driver.ts", "src/session.ts" and "src/utils.ts")
|
10
10
|
[1mdrizzle-orm/pg-core[22m (imported by "src/driver.ts", "src/session.ts" and "src/generate.ts")
|
11
|
-
[32mcreated [1mdist/index.cjs, dist/index.mjs[22m in [
|
11
|
+
[32mcreated [1mdist/index.cjs, dist/index.mjs[22m in [1m835ms[22m[39m
|
12
12
|
[36m
|
13
13
|
[1msrc/index.ts[22m → [1mdist/index.d.ts[22m...[39m
|
14
|
-
[32mcreated [1mdist/index.d.ts[22m in [
|
14
|
+
[32mcreated [1mdist/index.d.ts[22m in [1m13.1s[22m[39m
|
package/CHANGELOG.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# @xata.io/drizzle
|
2
2
|
|
3
|
-
## 0.0.
|
3
|
+
## 0.0.1
|
4
4
|
|
5
5
|
### Patch Changes
|
6
6
|
|
7
|
-
- [#1145](https://github.com/xataio/client-ts/pull/1145) [`
|
7
|
+
- [#1145](https://github.com/xataio/client-ts/pull/1145) [`e41d7faf`](https://github.com/xataio/client-ts/commit/e41d7faf40747fd31a08cdcd767d9596f88e4a20) Thanks [@SferaDev](https://github.com/SferaDev)! - Initial release
|
8
8
|
|
9
9
|
- Updated dependencies [[`22fccb51`](https://github.com/xataio/client-ts/commit/22fccb51709749c319897702c15749b74ce4b820)]:
|
10
|
-
- @xata.io/client@0.
|
10
|
+
- @xata.io/client@0.26.2
|
package/README.md
CHANGED
@@ -24,33 +24,47 @@ npm install drizzle-orm @xata.io/drizzle @xata.io/client
|
|
24
24
|
To work with drizzle you need to define your models and then create a drizzle instance with the models.
|
25
25
|
|
26
26
|
```ts
|
27
|
-
import { pgTable, text } from 'drizzle-orm/pg-core';
|
28
27
|
import { drizzle } from '@xata.io/drizzle';
|
28
|
+
import { sql } from 'drizzle-orm';
|
29
|
+
import { pgTable, text } from 'drizzle-orm/pg-core';
|
29
30
|
import { getXataClient } from './xata';
|
30
31
|
|
31
32
|
const xata = getXataClient();
|
32
|
-
const db = drizzle(xata);
|
33
33
|
|
34
34
|
const drivers = pgTable('drivers', {
|
35
35
|
id: text('id').primaryKey(),
|
36
36
|
surname: text('surname'),
|
37
|
-
forename: text('forename')
|
37
|
+
forename: text('forename'),
|
38
|
+
nationality: text('nationality')
|
38
39
|
});
|
39
40
|
|
40
|
-
const
|
41
|
+
const schema = {
|
42
|
+
drivers
|
43
|
+
};
|
44
|
+
|
45
|
+
const db = drizzle(xata, { schema });
|
46
|
+
|
47
|
+
const result = await db.execute(sql`select * from ${drivers} where ${drivers.nationality} = 'Spanish'`);
|
41
48
|
```
|
42
49
|
|
43
50
|
## [Experimental] Model generation
|
44
51
|
|
45
|
-
We offer an experimental model generation helper that will generate the models for you from your `tables` array in your `xata.ts` file. Since it's a work in progress, we don't recommend using it in
|
52
|
+
We offer an experimental model generation helper that will generate the models for you from your `tables` array in your `xata.ts` file. Since it's a work in progress, we don't recommend using it in your applications yet, please build your models manually. However, we would love to hear your feedback on it.
|
46
53
|
|
47
54
|
```ts
|
48
|
-
import { buildModels } from '@xata.io/drizzle';
|
49
|
-
import {
|
55
|
+
import { drizzle, buildModels } from '@xata.io/drizzle';
|
56
|
+
import { sql } from 'drizzle-orm';
|
57
|
+
import { pgTable, text } from 'drizzle-orm/pg-core';
|
58
|
+
import { getXataClient, tables } from './xata';
|
59
|
+
|
60
|
+
const xata = getXataClient();
|
61
|
+
|
62
|
+
const schema = buildModels(tables);
|
63
|
+
const { drivers } = schema;
|
50
64
|
|
51
|
-
const {
|
65
|
+
const db = drizzle(xata, { schema });
|
52
66
|
|
53
|
-
const result = await db.select
|
67
|
+
const result = await db.execute(sql`select * from ${drivers} where ${drivers.nationality} = 'Spanish'`);
|
54
68
|
```
|
55
69
|
|
56
70
|
## Limitations
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@xata.io/drizzle",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.1",
|
4
4
|
"description": "",
|
5
5
|
"main": "./dist/index.cjs",
|
6
6
|
"module": "./dist/index.mjs",
|
@@ -18,7 +18,7 @@
|
|
18
18
|
"url": "https://github.com/xataio/client-ts/issues"
|
19
19
|
},
|
20
20
|
"dependencies": {
|
21
|
-
"@xata.io/client": "0.
|
21
|
+
"@xata.io/client": "0.26.2"
|
22
22
|
},
|
23
23
|
"devDependencies": {
|
24
24
|
"drizzle-orm": "^0.28.5"
|