graphile / crystal-pre-merge

Repository moved
https://github.com/graphile/crystal
39 stars 8 forks source link

Polymorphic NodeIDs - dependency of other issues #473

Closed benjie closed 1 year ago

benjie commented 1 year ago

For an @interface mode:relational table, there are a lot of different NodeIDs (one for each concrete subtype). We need a way of taking one of any of these, and turning it into a spec that applies to the shared polymorphic table. For example, if we have

create table block (id uuid primary key, type text, ...);
create table title_block (block_id uuid primary key references block, ...);

comment on table block is '@interface mode:relational\n@type TITLE references:title_block';

The NodeID for a title_block will have a spec like {block_id: ...}. But to look up the root table, we actually want a spec like {id: ...}. It's the same value in the ... each time, but the key has changed.

If we can come up with a standard way of handling this, then it can be used as NodeID input to functions, filters, mutations, etc - all via a standard central logic.

Needed for: