Table security_groups
column id int;
Table rules
column id int;
column cidr varchar;
column type varchar; // ingress or egress
column parent_id reference sercurity_groups(id); // a rule belong to a security_group.
And I wish to create a relation that enables this query:
query {
security_groups {
ingress_rules { // return all rules of this security_group and type == "ingress"
cidr
}
egress_rules { // return all rules of this security_group and type == "egress"
cidr
}
}
}
Table schema looks like this:
And I wish to create a relation that enables this query:
Which means the following relations:
unfortunately from the hasura console, we can only select column to bind relations. not literals. But I thinks this is viable.