@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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @xata.io/drizzle@0.0.0 build /home/runner/work/client-ts/client-ts/packages/plugin-client-drizzle
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
  
@@ -8,7 +8,7 @@
8
8
  https://rollupjs.org/troubleshooting/#warning-treating-module-as-external-dependency
9
9
  drizzle-orm (imported by "src/driver.ts", "src/session.ts" and "src/utils.ts")
10
10
  drizzle-orm/pg-core (imported by "src/driver.ts", "src/session.ts" and "src/generate.ts")
11
- created dist/index.cjs, dist/index.mjs in 980ms
11
+ created dist/index.cjs, dist/index.mjs in 835ms
12
12
  
13
13
  src/index.ts → dist/index.d.ts...
14
- created dist/index.d.ts in 14.4s
14
+ created dist/index.d.ts in 13.1s
package/CHANGELOG.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # @xata.io/drizzle
2
2
 
3
- ## 0.0.0-alpha.vf5fbc45
3
+ ## 0.0.1
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - [#1145](https://github.com/xataio/client-ts/pull/1145) [`6934686c`](https://github.com/xataio/client-ts/commit/6934686cd7102d09d29deaf948c497f27cfdda87) Thanks [@SferaDev](https://github.com/SferaDev)! - Initial release
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.0.0-alpha.vf5fbc45
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 result = await db.select().from(drivers).execute();
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 production yet, please build your models manually.
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 { tables } from './xata';
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 { drivers } = buildModels(tables);
65
+ const db = drizzle(xata, { schema });
52
66
 
53
- const result = await db.select().from(drivers).execute();
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.0-alpha.vf5fbc45",
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.0.0-alpha.vf5fbc45"
21
+ "@xata.io/client": "0.26.2"
22
22
  },
23
23
  "devDependencies": {
24
24
  "drizzle-orm": "^0.28.5"