7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

GraphQLのクエリで配列型の引数を宣言する方法

Last updated at Posted at 2019-12-16

Prisma + Appoloクライアント経由でGraphQLクエリを作成した際に、引数に「配列」を渡す方法の備忘録

apollo/queries/getPosts.graphql
query GetPosts($ids: [Int!]) {
  posts(where: {
    Category: {
        Id_in: $ids
    }
  }) {
    Id
    Name
    CreatedAt
    UpdatedAt
  }
}
  • !(エクスクラメーションマーク)は、null制約を付与している
  • ポイントは、引数で宣言する配列はInt[]ではなく[Int]と表現すること

参考:Data modeling, Array of strings - Questions - Prisma Forum

7
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?