複雑なレコードのサブスクリプション
次の例では、id、firstName、email、age などのフィールドとリレーションを含む students というテーブルがあります。
フィルターを使用したサブスクリプション
Section titled “フィルターを使用したサブスクリプション”Archie Core の自動生成された GraphQL サブスクリプション操作を使用して、作成、更新、および削除される個々のレコードおよび関連レコードをサブスクライブできます。
利用可能な演算子
Section titled “利用可能な演算子”| 演算子 | 使用例 |
|---|---|
eq | status = "active" |
neq | type != "admin" |
gt | age > 18 |
lt | price < 100 |
gte | score >= 80 |
lte | attempts <= 3 |
contains | name contains "john" |
startsWith | email startsWith "admin" |
endsWith | domain endsWith ".com" |
複数の条件(論理 AND)
Section titled “複数の条件(論理 AND)”GraphQL ミューテーション
Section titled “GraphQL ミューテーション”mutation createNewSubscription($input: SubscriptionInput!) { system { createSubscription(input: $input) { id active name } }}{ "input": { "name": "students_create_gte_lte", "description": "Subscription - students table - create - gte lte", "active": true, "tables": [ { "table": "students", "operations": ["CREATE"], "fields": ["id", "first_name", "email", "age"], "conditions": [ { "field": "age", "operator": "GTE", "value": "25" }, { "field": "age", "operator": "LTE", "value": "50" } ] } ] }}{ "data": { "system": { "createSubscription": { "id": "id_subscription", "active": true, "name": "students_create_gte_lte" } } }}複数のテーブル
Section titled “複数のテーブル”GraphQL ミューテーション
Section titled “GraphQL ミューテーション”mutation createNewSubscription($input: SubscriptionInput!) { system { createSubscription(input: $input) { id active name } }}{ "input": { "name": "multiple_tables", "description": "Subscription multiple tables", "active": true, "tables": [ { "table": "students", "operations": ["CREATE"], "fields": ["id", "first_name", "email", "age"], "conditions": [ { "field": "age", "operator": "GTE", "value": "30" }, { "field": "age", "operator": "LTE", "value": "60" } ] }, { "table": "courses", "operations": ["UPDATE"], "fields": ["id", "code", "name_course", "price"], "conditions": [ { "field": "price", "operator": "LTE", "value": "500" } ] } ] }}{ "data": { "system": { "createSubscription": { "id": "id_subscription", "active": true, "name": "multiple_tables" } } }}