生成器
Prisma 模式可以有一个或多个生成器,由 generator 块表示:
¥A Prisma schema can have one or more generators, represented by the generator block:
generator client {
provider = "prisma-client"
output = "../generated/prisma"
}
生成器确定当你运行 prisma generate 命令时创建哪些资源。
¥A generator determines which assets are created when you run the prisma generate command.
Prisma 客户端有两个生成器:
¥There are two generators for Prisma Client:
-
prisma-client(推荐):更新、更灵活的prisma-client-js版本,支持 ESM;它输出纯 TypeScript 代码,并需要自定义output路径(有关 此处 的更多信息,请参阅)¥
prisma-client(recommended): Newer and more flexible version ofprisma-client-jswith ESM support; it outputs plain TypeScript code and requires a customoutputpath (read more about it here) -
prisma-client-js:将 Prisma 客户端生成到node_modules¥
prisma-client-js: Generates Prisma Client intonode_modules
或者,你可以配置任何符合我们生成器规范的 npm 包。
¥Alternatively, you can configure any npm package that complies with our generator specification.
prisma-client-js
prisma-client-js 是 Prisma ORM 6.X 及之前版本默认的生成器。它需要 @prisma/client npm 包,并将 Prisma 客户端生成到 node_modules 中。
¥The prisma-client-js is the default generator for Prisma ORM 6.X versions and before. It requires the @prisma/client npm package and generates Prisma Client into node_modules.
字段参考
¥Field reference
Prisma JavaScript 客户端的生成器接受多个附加属性:
¥The generator for Prisma's JavaScript Client accepts multiple additional properties:
-
previewFeatures:预览功能 包括¥
previewFeatures: Preview features to include -
binaryTargets:prisma-client-js的引擎二进制目标(例如,如果你要部署到 Ubuntu 18+,则为debian-openssl-1.1.x;如果你在本地工作,则为native)¥
binaryTargets: Engine binary targets forprisma-client-js(for example,debian-openssl-1.1.xif you are deploying to Ubuntu 18+, ornativeif you are working locally)
generator client {
provider = "prisma-client-js"
previewFeatures = ["sample-preview-feature"]
binaryTargets = ["debian-openssl-1.1.x"] // defaults to `"native"`
}
二进制目标
¥Binary targets
从 v6.16.0 开始,Prisma ORM 可以在生产应用中不使用 Rust 引擎使用。了解更多 此处。
¥As of v6.16.0, Prisma ORM can be used without Rust engines in production applications. Learn more here.
启用后,你的 Prisma 客户端将不包含基于 Rust 的查询引擎二进制文件:
¥When enabled, your Prisma Client will be generated without a Rust-based query engine binary:
generator client {
provider = "prisma-client-js" // or "prisma-client"
output = "../src/generated/prisma"
engineType = "client" // no Rust engine
}
请注意,如果你想在不使用 Rust 引擎的情况下使用 Prisma ORM,则需要 驱动适配器。
¥Note that driver adapters are required if you want to use Prisma ORM without Rust engines.
使用不带 Rust 的 Prisma ORM 时,binaryTargets 字段已过时且不再需要。
¥When using Prisma ORM without Rust, the binaryTargets field is obsolete and not needed.
你可以在我们的博客上了解此更改。
¥You can read about the performance and DX improvements of this change on our blog.
prisma-client-js 生成器使用多个 engines。引擎使用 Rust 实现,并以可执行的、平台相关的引擎文件的形式由 Prisma 客户端使用。根据你执行代码的平台,你需要正确的文件。"二进制目标" 用于定义目标平台应存在哪些文件。
¥The prisma-client-js generator uses several engines. Engines are implemented in Rust and are used by Prisma Client in the form of executable, platform-dependent engine files. Depending on which platform you are executing your code on, you need the correct file. "Binary targets" are used to define which files should be present for the target platform(s).
当你的应用投入生产时,正确的文件尤其重要,因为生产环境通常与你的本地开发环境不同。
¥The correct file is particularly important when deploying your application to production, which often differs from your local development environment.
native 二进制目标
¥The native binary target
native 二进制目标很特殊。它不映射到具体的操作系统。相反,当在 binaryTargets 中指定 native 时,Prisma Client 会检测当前操作系统并自动为其指定正确的二进制目标。
¥The native binary target is special. It doesn't map to a concrete operating system. Instead, when native is specified in binaryTargets, Prisma Client detects the current operating system and automatically specifies the correct binary target for it.
例如,假设你正在运行 macOS 并指定以下生成器:
¥As an example, assume you're running macOS and you specify the following generator:
generator client {
provider = "prisma-client-js"
binaryTargets = ["native"]
}
在这种情况下,Prisma 客户端会检测你的操作系统并根据 支持的操作系统列表 找到正确的二进制文件。 如果你使用 macOS Intel x86 (darwin),则将选择为 darwin 编译的二进制文件。如果你使用 macOS ARM64 (darwin-arm64),则将选择为 darwin-arm64 编译的二进制文件。
¥In that case, Prisma Client detects your operating system and finds the right binary file for it based on the list of supported operating systems .
If you use macOS Intel x86 (darwin), then the binary file that was compiled for darwin will be selected.
If you use macOS ARM64 (darwin-arm64), then the binary file that was compiled for darwin-arm64 will be selected.
注意:
native二进制目标是默认值。如果你希望包含额外的 二进制目标 以部署到不同的环境,你可以明确设置它。¥Note: The
nativebinary target is the default. You can set it explicitly if you wish to include additional binary targets for deployment to different environments.
prisma-client
新的 prisma-client 生成器在不同的 JavaScript 环境(例如 ESM、Bun、Deno 等)中使用 Prisma ORM 时,提供了更强大的控制力和灵活性。
¥The new prisma-client generator offers greater control and flexibility when using Prisma ORM across different JavaScript environments (such as ESM, Bun, Deno, ...).
它会将 Prisma 客户端生成到应用代码库中的自定义目录中,该目录通过 generator 块中的 output 字段指定。这将使你能够完全查看和控制生成的代码。它还将生成的 Prisma 客户端库 splits 到多个文件中。
¥It generates Prisma Client into a custom directory in your application's codebase that's specified via the output field on the generator block. This gives you full visibility and control over the generated code. It also splits the generated Prisma Client library into multiple files.
此生成器确保你可以按照所需的方式打包应用代码,而无需依赖隐藏或自动行为。
¥This generator ensures you can bundle your application code exactly the way you want, without relying on hidden or automatic behaviors.
与 prisma-client-js 相比,主要区别如下:
¥Here are the main differences compared to prisma-client-js:
-
需要
output路径;不再将 "magic" 生成到node_modules中¥Requires an
outputpath; no "magic" generation intonode_modulesany more -
运行时不加载
.env;使用dotenv或手动设置环境变量¥Doesn't load
.envat runtime; usedotenvor set environment variables manually instead -
通过
moduleFormat字段支持 ESM 和 CommonJS¥Supports ESM and CommonJS via the
moduleFormatfield -
新增 fields,让你更加灵活
¥More flexible thanks to additional fields
-
输出纯 TypeScript,与应用的其他代码一样打包在一起。
¥Outputs plain TypeScript that's bundled just like the rest of your application code
prisma-client 生成器已正式发布,因为 v6.16.0 将成为 Prisma ORM v7 的新默认生成器。
¥The prisma-client generator has been Generally Available since v6.16.0 will become the new default with Prisma ORM v7.
入门
¥Getting started
按照以下步骤在你的项目中使用新的 prisma-client 生成器。
¥Follow these steps to use the new prisma-client generator in your project.
1. 在 schema.prisma 中配置 prisma-client 生成器
¥ Configure the prisma-client generator in schema.prisma
更新你的 generator 块:
¥Update your generator block:
generator client {
provider = "prisma-client" // Required
output = "../src/generated/prisma" // Required
}
output 选项是必需的,它告诉 Prisma ORM 将生成的 Prisma 数据放在何处客户端代码。你可以选择任何适合你项目结构的位置。例如,如果你有以下布局:
¥The output option is required and tells Prisma ORM where to put the generated Prisma Client code. You can choose any location suitable for your project structure. For instance, if you have the following layout:
.
├── package.json
├── prisma
│ └── schema.prisma
├── src
│ └── index.ts
└── tsconfig.json
然后,../src/generated/prisma 将生成的代码放置在 src/generated/prisma 中,并相对于 schema.prisma 进行放置。
¥Then ../src/generated/prisma places the generated code in src/generated/prisma relative to schema.prisma.
2. 生成 Prisma 客户端
¥ Generate Prisma Client
运行以下命令生成 Prisma 客户端:
¥Generate Prisma Client by running:
npx prisma generate
这会将 Prisma 客户端的代码(包括查询引擎二进制文件)生成到指定的 output 文件夹中。
¥This generates the code for Prisma Client (including the query engine binary) into the specified output folder.
3. 从版本控制中排除生成的目录
¥ Exclude the generated directory from version control
新的生成器包含 TypeScript 客户端代码和 查询引擎。将查询引擎纳入版本控制可能会导致不同机器上的兼容性问题。为避免这种情况,请将生成的目录添加到 .gitignore:
¥The new generator includes both the TypeScript client code and the query engine. Including the query engine in version control can cause compatibility issues on different machines. To avoid this, add the generated directory to .gitignore:
# Keep the generated Prisma Client + query engine out of version control
/src/generated/prisma
将来,你可以在 Prisma ORM 已完全从 Rust 过渡到 TypeScript 时安全地将生成的目录包含在版本控制中。
¥In the future, you can safely include the generated directory in version control when Prisma ORM is fully transitioned from Rust to TypeScript.
4. 在应用中使用 Prisma 客户端
¥ Use Prisma Client in your application
导入 Prisma 客户端
¥Importing Prisma Client
生成 Prisma 客户端后,从你指定的路径导入它:
¥After generating the Prisma Client, import it from the path you specified:
import { PrismaClient } from "./generated/prisma/client";
const prisma = new PrismaClient();
Prisma 客户端现在可以在你的项目中使用了。
¥Prisma Client is now ready to use in your project.
导入生成的模型类型
¥Importing generated model types
如果你要导入为模型生成的类型,可以按如下方式操作:
¥If you're importing types generated for your models, you can do so as follows:
import { UserModel, PostModel } from "./generated/prisma/models";
导入生成的枚举类型
¥Importing generated enum types
如果你要导入为枚举生成的类型,可以按如下方式操作:
¥If you're importing types generated for your enums, you can do so as follows:
import { Role, User } from "./generated/prisma/enums";
在浏览器环境中导入
¥Importing in browser environments
如果你需要在前端代码中访问生成的类型,可以按如下方式导入它们:
¥If you need to access generated types in your frontend code, you can import them as follows:
import { Role } from "./generated/prisma/browser";
请注意,./generated/prisma/browser 不会暴露 PrismaClient。
¥Note that ./generated/prisma/browser does not expose a PrismaClient.
字段参考
¥Field reference
在 generator client { ... } 块中使用以下选项。仅需要 output。其他字段使用默认值,或根据你的环境和 tsconfig.json 推断得出。
¥Use the following options in the generator client { ... } block. Only output is required. The other fields have defaults or are inferred from your environment and tsconfig.json.
generator client {
// Required
provider = "prisma-client"
output = "../src/generated/prisma"
// Optional
engineType = "client"
runtime = "nodejs"
moduleFormat = "esm"
generatedFileExtension = "ts"
importFileExtension = "ts"
}
以下是 prisma-client 生成器的选项:
¥Below are the options for the prisma-client generator:
| 选项 | 默认 | 描述 |
|---|---|---|
output(必需) | 生成 Prisma 客户端的目录,例如 ../src/generated/prisma。 | |
runtime | nodejs | 目标运行时环境。 支持的值:nodejs、deno、bun、workerd(别名 cloudflare)、vercel-edge(别名 edge-light)、react-native。 |
moduleFormat | 从环境推断 | 模块格式(esm 或 cjs)。确定使用 import.meta.url 还是 __dirname。 |
generatedFileExtension | ts | 生成的 TypeScript 文件(ts、mts、cts)的文件扩展名。 |
importFileExtension | 从环境推断 | 导入语句中使用的文件扩展名。可以是 ts、mts、cts、js、mjs、cjs 或空(用于裸导入)。 |
nodejs、deno 和 bun 都映射到相同的内部代码路径,但为了清晰起见,它们保留为单独的面向用户的值。
¥nodejs, deno, and bun all map to the same internal codepath but are preserved as separate user-facing values for clarity.
导入类型
¥Importing types
新的 prisma-client 生成器会创建单独的 .ts 文件,以便更精细地导入类型。这可以提升编译和类型检查的性能,并且对 tree-shaking 也很有用。你仍然可以使用通过单个导入导出所有类型的顶层 barrel 文件。
¥The new prisma-client generator creates individual .ts files which allow for a more fine granular import of types. This can improve compile and typecheck performance and be useful for tree-shaking, too.
You can still use the top level barrel files that export all types through a single import.
生成的输出的整体结构如下所示:
¥The overall structure of the generated output looks like this:
generated/
└── prisma
├── browser.ts
├── client.ts
├── commonInputTypes.ts
├── enums.ts
├── internal
│ ├── ...
├── models
│ ├── Post.ts
│ └── User.ts
└── models.ts
client.ts
用于服务器代码。
¥For use in your server code.
-
提供对
PrismaClient实例以及所有模型和工具类型的访问权限。¥Provides access to the
PrismaClientinstance and all model and utility types. -
与
prisma-client-js生成的输出保持最佳兼容性。¥Provides best compatibility with the
prisma-client-jsgenerated output. -
包含对服务器端软件包的传递依赖,因此无法在浏览器环境中使用。
¥Contains transitive dependencies on server only-packages, so cannot be used in browser contexts.
示例:
¥Example:
import { Prisma, type Post, PrismaClient } from "./generated/prisma/client"
browser.ts
用于在前端(即在浏览器中运行的代码)中使用类型。
¥For using types in your frontend (i.e. code that runs in the browser).
-
不包含对 Node.js 或其他服务器端软件包的传递依赖。
¥Contains no transitive dependencies on Node.js or other server-only packages.
-
不包含真正的
PrismaClient构造函数。¥Contains no real
PrismaClientconstructor. -
包含所有模型和枚举类型及值。
¥Contains all model and enum types and values.
-
提供对各种实用程序(例如
Prisma.JsonNull和Prisma.Decimal)的访问权限。¥Provides access to various utilities like
Prisma.JsonNullandPrisma.Decimal. -
自
v6.16.0起可用。¥Available since
v6.16.0.
旧的 prisma-client-js 生成器会创建一个 node_modules 包,并使用导出映射来动态提供生成的 Prisma 客户端库的浏览器兼容导出。由于新的 prisma-client 生成器直接创建 TypeScript 源代码,而不再创建 package.json 文件,因此这种方法不可行。因此,你需要明确你的导入以及程序是在服务器还是客户端上运行!
¥The old prisma-client-js generator created a node_modules package and used export maps to dynamically provide a browser compatible export of the generated Prisma Client library. As the new prisma-client generator creates direct TypeScript source code and no package.json file anymore, this approach is not possible. Hence you need to be explicit about your imports and whether things run on server or client!
你仍然可以将生成的代码封装在一个包中,并使用与 prisma-client-js 类似的方法自行处理。
¥You can still wrap the generated code in a package and use a similar approach as with prisma-client-js on your own.
示例:
¥Example:
import { Prisma, type Post } from "./generated/prisma/browser"
enums.ts
对用户定义的枚举类型和值的隔离访问。
¥Isolated access to user defined enum types and values.
-
不包含传递依赖,并且非常精简。
¥Contains no transitive dependencies and is very slim.
-
可用于后端和前端。
¥Can be used on backend and frontend.
-
访问枚举时,为了获得最佳的摇树优化和类型检查性能,建议使用此版本。
¥Prefer this for optimal tree shaking and typecheck performance when accessing enums.
示例:
¥Example:
import { MyEnum } from "./generated/prisma/enums"
models.ts
对所有模型类型的隔离访问。
¥Isolated access to all model types.
-
可用于后端和前端。
¥Can be used on backend and frontend.
-
包含所有模型,包括其派生的工具类型,例如
<ModelName>WhereInput或<ModelName>UpdateInput>。¥Contains all models including their derived utility types like
<ModelName>WhereInputor<ModelName>UpdateInput>.
普通模型类型在此处公开为 <ModelName>Model(例如 PostModel)。这与 client.ts 和 browser.ts 中暴露的名称 <ModelName>(例如 Post)相反。
¥Plain model types are exposed here as <ModelName>Model (e.g. PostModel). This is in contrast to the exposed name in client.ts and browser.ts which is simply <ModelName> (e.g. Post).
由于内部约束,这样做是必要的,以避免与内部类型发生潜在的命名冲突。
¥This is necessary due to internal constraints to avoid potential naming conflicts with internal types.
示例:
¥Example:
import type { UserModel, PostModel, PostWhereInput, UserUpdateInput } from "./generated/prisma/models"
models/<ModelName>.ts
对单个模型类型的隔离访问。
¥Isolated access to the types for an individual model.
-
可用于后端和前端。
¥Can be used on backend and frontend.
-
包含模型及其派生的工具类型,例如
<ModelName>WhereInput或<ModelName>UpdateInput>。¥Contains the models including its derived utility types like
<ModelName>WhereInputor<ModelName>UpdateInput>.
普通模型类型在此处显示为 <ModelName>Model(例如 PostModel)。
¥The plain model type is exposed here as <ModelName>Model (e.g. PostModel).
示例:
¥Example:
import type { UserModel, UserWhereInput, UserUpdateInput } from "./generated/prisma/models/User"
commonInputTypes.ts
提供你很少直接需要的共享工具类型。
¥Provides shared utility types that you should rarely directly need.
示例:
¥Example:
import type { IntFilter } from "./generated/prisma/commonInputTypes"
internal/*
请勿直接从这些文件导入!它们不属于生成代码的稳定 API,并且随时可能以重大方式发生变化。
¥Do not directly import from these files! They are not part of the stable API of the generated code and can change at any time in breaking ways.
通常,你可能需要的任何内容都会通过 Prisma 命名空间下的 browser.ts 或 client.ts 公开。
¥Usually anything you might need from there is exposed via browser.ts or client.ts under the Prisma namespace.
prisma-client-js 的重大变更
¥Breaking changes from prisma-client-js
-
需要
generator块上的output路径¥Requires an
outputpath on thegeneratorblock -
没有
Prisma.validator功能;你可以改用 TypeScript 原生satisfies关键字¥No
Prisma.validatorfunction; you can use TypeScript nativesatisfieskeyword instead
示例
¥Examples
要了解新的 prisma-client 生成器的实际效果,请查看我们的极简 可立即运行的示例 生成器:
¥To see what the new prisma-client generator looks like in practice, check out our minimal and ready-to-run examples:
| 示例 | 框架 | 打包器 | 运行时 | Monorepo |
|---|---|---|---|---|
nextjs-starter-webpack | Next.js 15 | Webpack | Node.js | 不适用 |
nextjs-starter-turbopack | Next.js 15 | Turbopack(alpha 版) | Node.js | 不适用 |
nextjs-starter-webpack-monorepo | Next.js 15 | Webpack | Node.js | pnpm |
nextjs-starter-webpack-with-middleware | Next.js 15 | Webpack | Node.js(主页),vercel-edge(中间件) | 不适用 |
nextjs-starter-webpack-turborepo | Next.js 15 | Webpack | Node.js | turborepo |
react-router-starter-nodejs | React Router 7 | Vite 6 | Node.js | 不适用 |
react-router-starter-cloudflare-workerd | React Router 7 | 不适用 | ||
nuxt3-starter-nodejs | Nuxt 3 | Vite 6 | Node.js | 不适用 |
nuxt4-starter-nodejs | Nuxt 4 | Vite 7 | Node.js | 不适用 |
bun | 无 | 无 | Deno 2 | 不适用 |
deno | 无 | 无 | Deno 2 | 不适用 |
社区生成器
¥Community generators
如果你使用 多文件 Prisma Schema,现有生成器或新生成器不会受到影响,除非生成器手动读取模式。
¥Existing generators or new ones should not be affected if you are using a multi-file Prisma schema, unless a generator reads the schema manually.
以下是社区创建的生成器列表。
¥The following is a list of community created generators.
-
prisma-dbml-generator:将 Prisma 模式转换为 数据库标记语言 (DBML),从而实现简单的可视化表示¥
prisma-dbml-generator: Transforms the Prisma schema into Database Markup Language (DBML) which allows for an easy visual representation -
prisma-docs-generator:为 Prisma 客户端生成单独的 API 参考¥
prisma-docs-generator: Generates an individual API reference for Prisma Client -
prisma-json-schema-generator:转换 JSON 架构 中的 Prisma 架构¥
prisma-json-schema-generator: Transforms the Prisma schema in JSON schema -
prisma-json-types-generator:增强prisma-client-js(或prisma-client),根据你的架构为所有数据库提供强类型 JSON 字段。它可以改进代码生成、智能感知等功能,而不会影响运行时代码。¥
prisma-json-types-generator: Enhancesprisma-client-js(orprisma-client) to provide strongly typed JSON fields for all databases, based on your schema. It improves code generation, Intellisense, and more, without affecting runtime code. -
typegraphql-prisma:为 Prisma 模型生成 类型 GraphQL CRUD 解析器¥
typegraphql-prisma: Generates TypeGraphQL CRUD resolvers for Prisma models -
typegraphql-prisma-nestjs:typegraphql-prisma的复刻,它还为 Prisma 模型生成 CRUD 解析器,但为 NestJS 生成 CRUD 解析器¥
typegraphql-prisma-nestjs: Fork oftypegraphql-prisma, which also generates CRUD resolvers for Prisma models but for NestJS -
prisma-typegraphql-types-gen:从你的 prisma 类型定义生成 类型 GraphQL 类类型和枚举,生成的输出可以进行编辑,而不会被下一代覆盖,并且能够在你编辑弄乱类型时纠正你。¥
prisma-typegraphql-types-gen: Generates TypeGraphQL class types and enums from your prisma type definitions, the generated output can be edited without being overwritten by the next gen and has the ability to correct you when you mess up the types with your edits. -
nexus-prisma:允许通过 GraphQL Nexus 将 Prisma 模型投影到 GraphQL¥
nexus-prisma: Allows to project Prisma models to GraphQL via GraphQL Nexus -
prisma-nestjs-graphql:从 Prisma 模式生成对象类型、输入、参数等,以用于@nestjs/graphql模块¥
prisma-nestjs-graphql: Generates object types, inputs, args, etc. from the Prisma Schema for usage with@nestjs/graphqlmodule -
prisma-appsync:为 AWS 应用同步 生成成熟的 GraphQL API¥
prisma-appsync: Generates a full-blown GraphQL API for AWS AppSync -
prisma-kysely:为 TypeScript SQL 查询构建器 Kysely 生成类型定义。这对于从边缘运行时对数据库执行查询很有用,或者在不降低类型安全性的情况下编写在 Prisma 中不可能实现的更复杂的 SQL 查询。¥
prisma-kysely: Generates type definitions for Kysely, a TypeScript SQL query builder. This can be useful to perform queries against your database from an edge runtime, or to write more complex SQL queries not possible in Prisma without dropping type safety. -
prisma-generator-nestjs-dto:生成具有关系connect和create选项的 DTO 和实体类,以便与 NestJS 资源 和 @nestjs/swagger 一起使用¥
prisma-generator-nestjs-dto: Generates DTO and Entity classes with relationconnectandcreateoptions for use with NestJS Resources and @nestjs/swagger -
prisma-erd-generator:生成实体关系图¥
prisma-erd-generator: Generates an entity relationship diagram -
prisma-generator-plantuml-erd:生成器用于为 PlantUML 生成 ER 图。还可以通过激活该选项来生成 Markdown 和 Asciidoc 文档。¥
prisma-generator-plantuml-erd: Generator to generate ER diagrams for PlantUML. Markdown and Asciidoc documents can also be generated by activating the option. -
prisma-class-generator:从 Prisma 架构生成可用作 DTO、Swagger Response、TypeGraphQL 等的类。¥
prisma-class-generator: Generates classes from your Prisma Schema that can be used as DTO, Swagger Response, TypeGraphQL and so on. -
zod-prisma:从 Prisma 模型创建 Zod 模式。¥
zod-prisma: Creates Zod schemas from your Prisma models. -
prisma-pothos-types:可以更轻松地定义基于 Prisma 的对象类型,并帮助解决 n+1 关系查询。它还集成了 Relay 插件,使定义节点和连接变得简单高效。¥
prisma-pothos-types: Makes it easier to define Prisma-based object types, and helps solve n+1 queries for relations. It also has integrations for the Relay plugin to make defining nodes and connections easy and efficient. -
prisma-generator-pothos-codegen:自动生成输入类型(用作参数)和自动生成解耦的类型安全基本文件可以轻松地从 Prisma 模式为 绿萝 创建可定制的对象、查询和突变。可以选择从基本文件一次生成所有增删改查内容。¥
prisma-generator-pothos-codegen: Auto generate input types (for use as args) and auto generate decoupled type-safe base files makes it easy to create customizable objects, queries and mutations for Pothos from Prisma schema. Optionally generate all crud at once from the base files. -
prisma-joi-generator:从 Prisma 模式生成完整的 Joi 模式。¥
prisma-joi-generator: Generate full Joi schemas from your Prisma schema. -
prisma-yup-generator:从你的 Prisma 模式生成完整的 Yup 模式。¥
prisma-yup-generator: Generate full Yup schemas from your Prisma schema. -
prisma-class-validator-generator:从 Prisma 架构中触发 TypeScript 模型,并准备好类验证器验证。¥
prisma-class-validator-generator: Emit TypeScript models from your Prisma schema with class validator validations ready. -
prisma-zod-generator:从 Prisma 模式中触发 Zod 模式。¥
prisma-zod-generator: Emit Zod schemas from your Prisma schema. -
prisma-trpc-generator:触发完全实现的 tRPC 路由。¥
prisma-trpc-generator: Emit fully implemented tRPC routers. -
prisma-json-server-generator:触发一个可以与 json-server 一起运行的 JSON 文件。¥
prisma-json-server-generator: Emit a JSON file that can be run with json-server. -
prisma-trpc-shield-generator:从 Prisma 架构中触发 tRPC 屏蔽。¥
prisma-trpc-shield-generator: Emit a tRPC shield from your Prisma schema. -
prisma-custom-models-generator:根据 Prisma 建议,从 Prisma 架构中触发自定义模型。¥
prisma-custom-models-generator: Emit custom models from your Prisma schema, based on Prisma recommendations. -
nestjs-prisma-graphql-crud-gen:使用 NestJS 和 Prisma 从 GraphQL 架构生成 CRUD 解析器。¥
nestjs-prisma-graphql-crud-gen: Generate CRUD resolvers from GraphQL schema with NestJS and Prisma. -
prisma-generator-dart:使用 to- 和 fromJson 方法生成 Dart/Flutter 类文件。¥
prisma-generator-dart: Generates Dart/Flutter class files with to- and fromJson methods. -
prisma-generator-graphql-typedef:生成 graphql 模式。¥
prisma-generator-graphql-typedef: Generates graphql schema. -
prisma-markdown:生成由 ERD 图及其描述组成的 Markdown 文档。支持通过@namespace注释标签对 ERD 图进行分页。¥
prisma-markdown: Generates markdown document composed with ERD diagrams and their descriptions. Supports pagination of ERD diagrams through@namespacecomment tag. -
prisma-models-graph:为模式生成双向模型图,无需在模式中定义严格的关系,通过自定义模式注释工作。¥
prisma-models-graph: Generates a bi-directional models graph for schema without strict relationship defined in the schema, works via a custom schema annotation. -
prisma-generator-fake-data:为你的 Prisma 模型生成逼真的假数据,可用于单元/集成测试、演示等。¥
prisma-generator-fake-data: Generates realistic-looking fake data for your Prisma models that can be used in unit/integration tests, demos, and more. -
prisma-generator-drizzle:Prisma 生成器可轻松生成 Drizzle 模式。¥
prisma-generator-drizzle: A Prisma generator for generating Drizzle schema with ease. -
prisma-generator-express:生成 Express CRUD 和 Router 生成器函数。¥
prisma-generator-express: Generates Express CRUD and Router generator function. -
prismabox:从 Prisma 模型生成多功能 typebox 模式。¥
prismabox: Generates versatile typebox schema from your Prisma models. -
prisma-generator-typescript-interfaces:从 Prisma 模式生成零依赖 TypeScript 接口。¥
prisma-generator-typescript-interfaces: Generates zero-dependency TypeScript interfaces from your Prisma schema. -
prisma-openapi:从 Prisma 模型生成 OpenAPI 模式。¥
prisma-openapi: Generates OpenAPI schema from Prisma models.