Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save steebchen/b3d4b8fb0b01ee5bbd936e1ad71cef1f to your computer and use it in GitHub Desktop.
Save steebchen/b3d4b8fb0b01ee5bbd936e1ad71cef1f to your computer and use it in GitHub Desktop.
## example
```js
const user = await prisma.user.update({
where: {
email: 'alice@prisma.io',
},
data: {
posts: {
update: [
// a
{
data: { published: true },
where: { id: 32 },
},
// b
{
data: { published: true },
where: { id: 23 },
},
],
},
},
})
```
with specific go client syntax:
```go
result, err := client.User.FindOne(
db.User.Email.Equals("alice@prisma.io"),
).Update(
db.User.Posts.Update(
// a
User.Posts.FindOne(
User.ID.Equals(32),
).Update(
User.Published.Set(true),
),
// b
User.Posts.FindOne(
User.ID.Equals(32),
).Update(
User.Published.Set(true),
),
),
)
```
with inputTypes:
```go
result, err := client.User.UpdateOne(
db.UserWhereUniqueInput(
db.UserWhereUniqueInputEmail("alice@prisma.io"),
),
// data
db.UserUpdateInput(
// posts
db.PostUpdateManyWithoutAuthorInput(
// update (arr)
db.PostUpdateWithWhereUniqueWithoutAuthorInput(
db.UserUpdateWithWhereUniqueInput(
db.PostWhereUniqueInput(
db.PostWhereUniqueInputID(32),
),
db.PostUpdateWithoutAuthorDataInput(
db.PostUpdateWithoutAuthorDataInputPublished(true),
),
),
),
db.PostUpdateWithWhereUniqueWithoutAuthorInput(
db.UserUpdateWithWhereUniqueInput(
db.PostWhereUniqueInput(
db.PostWhereUniqueInputID(23),
),
db.PostUpdateWithoutAuthorDataInput(
db.PostUpdateWithoutAuthorDataInputPublished(true),
),
),
),
),
),
)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment