1
1

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 1 year has passed since last update.

【AWS】AppSync GraphQLのクエリfilter検索条件

Last updated at Posted at 2022-12-27

AppSyncのGraphQL検索条件のfilter条件をまとめてみます。

filter

operator description
eq 指定した値と一致する(=)
ne 指定した値と一致しない(!=)
gt 指定した値より大きい(>)
ge 指定した値以上(>=)
lt 指定した値より小さい(<)
le 指定した値以下(<=)
between 指定した1つ目の値よりも大きく、2つめの値よりも小さい
contains 指定した値が含まれる
notContains 指定した値が含まれない
beginsWith 指定した値で先頭一致
and すべての条件を満たす
or いずれかの条件を満たす
not 指定した条件を満たさない
input ModelStringInput {
	ne: String
	eq: String
	le: String
	lt: String
	ge: String
	gt: String
	contains: String
	notContains: String
	between: [String]
	beginsWith: String
	attributeExists: Boolean
	attributeType: ModelAttributeTypes
	size: ModelSizeInput
}

使用例

let filter = {
      or: [{ priority: {eq:1} },
           { priority: {eq:2} }]
  };
await API.graphql({ query: listProducts, variables: { filter: filter}}));
let filter = {
  number: { ge: 1, le: 100 },
}
let filter = { 
  createdAt: { between: ["2022-01-01", "2022-12-31"] },
}

参考

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?