Best Practices


Best practices

Prisma Client Go needs to generate code to work. This means that you need to run the generator before you can use it. We recommend to use Go's built-in go generate (opens in a new tab) to run the generator.

Set up go generate

While this step is not required, we recommend to use go generate (opens in a new tab) to simplify generating the Prisma Client Go client. To do so, you can just put the following line into a go file, and then run go generate so go run generate and any other generate commands you run will get executed.

Put this line into a Go file in your project, usually in main.go:

//go:generate go run generate
func main() {
// ...

Now, run go generate:

go generate ./...

Your Prisma Client Go code is now generated.

All source code and content licensed under Apache 2.0