اشتراكات السجلات المعقدة
في الأمثلة التالية، لدينا جدول يسمى students، والذي يحتوي على حقول وعلاقات مثل id و firstName و email و age.
الاشتراكات باستخدام الفلاتر
Section titled “الاشتراكات باستخدام الفلاتر”يمكنك الاشتراك في السجلات الفردية والسجلات ذات الصلة التي يتم إنشاؤها وتحديثها وحذفها باستخدام عملية اشتراك GraphQL المُنشأة تلقائيًا بواسطة Archie Core.
العوامل المتاحة
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 } }}المتغيرات
Section titled “المتغيرات”{ "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" } ] } ] }}الاستجابة
Section titled “الاستجابة”{ "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 } }}المتغيرات
Section titled “المتغيرات”{ "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" } ] } ] }}الاستجابة
Section titled “الاستجابة”{ "data": { "system": { "createSubscription": { "id": "id_subscription", "active": true, "name": "multiple_tables" } } }}