Prisma ClientFeatures

Check Existence (Go)

Overview

The Prisma client lets you check whether a certain record exists in the database using the Exists property. For each model type in your datamodel, the Prisma client exposes one function on this property named after the model (but lowercased). Each of these functions receives a a filter object as input argument that specifies the conditions for the record and returns a boolean value that's true if there's at least one database record matching the specified filter, false otherwise.

Examples

Check if a user with a certain ID exists:

userExists := client.Exists.User(&prisma.UserWhereUniqueInput{
  ID: "cjli6tko8005t0a23fid7kke7",
})
Content
Overview