Complex Record Subscriptions
In the following examples, we have a table called students, which contains fields and relations like id, firstName, email, age.
Subscriptions using filters
Section titled “Subscriptions using filters”You can subscribe to individual and related records being created, updated, and deleted using Archie Core’s auto-generated GraphQL subscriptiong operation.
Available Operators
Section titled “Available Operators”| Operator | Usage Example |
|---|---|
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" |
Multiple Conditions (Logical AND)
Section titled “Multiple Conditions (Logical AND)”GraphQL Mutation
Section titled “GraphQL Mutation”mutation createNewSubscription($input: SubscriptionInput!) { system { createSubscription(input: $input) { id active name } }}Variables
Section titled “Variables”{ "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" } ] } ] }}Response
Section titled “Response”{ "data": { "system": { "createSubscription": { "id": "id_subscription", "active": true, "name": "students_create_gte_lte" } } }}Multiple Tables
Section titled “Multiple Tables”GraphQL Mutation
Section titled “GraphQL Mutation”mutation createNewSubscription($input: SubscriptionInput!) { system { createSubscription(input: $input) { id active name } }}Variables
Section titled “Variables”{ "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" } ] } ] }}Response
Section titled “Response”{ "data": { "system": { "createSubscription": { "id": "id_subscription", "active": true, "name": "multiple_tables" } } }}