You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-21
Original file line number
Diff line number
Diff line change
@@ -1,28 +1,35 @@
1
-
# SurrealDB Client & Zod Schema Generator
1
+
# SurrealDB Client & Zod Schema Generator
2
2
3
3
SurrealDB Schema Generator is a handy tool that simplifies the process of generating [zod](http://zod.dev) schemas and TypeScript clients for [SurrealDB](http://surrealdb.com) based on your provided database schema.
4
4
Its primary purpose is to offer a fundamental starting point, not to replace a full-blown automated ORM.
5
5
6
-
## Features
6
+
## Features
7
7
8
-
- Generate zod schemas and TypeScript clients for SurrealDB.
9
-
- Utilize your existing database schema created with excellent tools like [surrealist.app](https://surrealist.app/).
10
-
- Benefit from a user-friendly **Designer** in Surrealist to craft your data model effortlessly.
11
-
- Export your schema from Surrealist and use it with this tool.
12
-
- Choose to generate only zod schemas or include a basic TypeScript client.
13
-
- Utilize zod schemas for [CIRQL](https://cirql.starlane.studio/) if needed.
8
+
- Generate zod schemas and TypeScript clients for SurrealDB.
9
+
- Utilize your existing database schema created with excellent tools like [surrealist.app](https://surrealist.app/).
10
+
- Benefit from a user-friendly **Designer** in Surrealist to craft your data model effortlessly.
11
+
- Export your schema from Surrealist and use it with this tool.
12
+
- Choose to generate only zod schemas or include a basic TypeScript client.
13
+
- Utilize zod schemas for [CIRQL](https://cirql.starlane.studio/) if needed.
14
14
15
-
## How It Works
15
+
## 🚨 Warning Version 2.x
16
16
17
-
SurrealDB Schema Generator connects to your specified database and extracts the provided `DEFINE` information.
18
-
Additionally, you can provide a SurrealQL file containing conditions.
19
-
Before fetching the `DEFINE` information, the tool queries the SurrealDB instance using the conditions specified in the file.
17
+
Version 2 has breaking changes!
18
+
The tool now uses `surrealdb.js` instead of `surrealdb.node` for interacting with a SurrealDB instance.
20
19
21
-
**Please Note:**
22
-
The information is not directly extracted from the provided file - it is written to the database in advance.
20
+
The change was made, because it seems that `surrealdb.js` is closer to the SurrealDB development process and more up to date in general.
23
21
24
-
Enjoy using SurrealDB Schema Generator to streamline your schema generation process for SurrealDB and zod.
25
-
It's designed to make your life easier when working with these powerful technologies.
22
+
This means, the option "memory" for connections is no longer available, and you need to run against a real running SurrealDB instance (use docker).
23
+
24
+
## How It Works
25
+
26
+
1. SurrealDB Schema Generator connects to your specified database
27
+
2. If you provide a surql schema file, the SurrealQL schema is written to the database
28
+
3. The generator extracts the `DEFINE` information from the connected database
29
+
4. Based on the definitions found in the database, the zod schemas are generated
30
+
31
+
Enjoy using SurrealDB Schema Generator to streamline your schema generation process for SurrealDB and zod.
32
+
It's designed to make your life easier when working with these powerful technologies.
26
33
27
34
## Installation
28
35
@@ -32,13 +39,13 @@ You can directly execute the generation:
32
39
npx surql-gen
33
40
```
34
41
35
-
Or you can install the generator as depenedency into your project.
42
+
Or you can install the generator as dependency into your project.
36
43
37
44
```bash
38
45
npm i -D @sebastianwessel/surql-gen
39
46
```
40
-
In case you install the generator as dependency or you installed it globally, you can call directly `surql-gen`
41
47
48
+
In case you install the generator as dependency or you installed it globally, you can call directly `surql-gen`
42
49
43
50
## How to Use
44
51
@@ -65,8 +72,8 @@ Generate zod schema and typescript client code from running Surreal database
65
72
Options:
66
73
-V, --version output the version number
67
74
-f, --schemaFile a SurrealQL file containing the definitions (default: myschema.surql)
@@ -119,7 +126,6 @@ They serve as safe spaces for your customizations, changes, and enhancements:
119
126
**Customization Freedom**: You can confidently make modifications and enhancements in these subfolders without worrying about them being altered by future executions of the tool.
120
127
This design allows you to tailor the generated code to your project's specific requirements, ensuring a seamless development experience.
121
128
122
-
123
129
---
124
130
125
131
If you like this tool, I please you, to give a star ⭐️ on github:
0 commit comments