You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to use computed fields to expose derived data, such as entity status (e.g. how far along is the user in a sign-up flow). With scalar computed fields, I have to use some loose type (usually text or numeric) instead of some kind of table-based enum.
Describe the solution you'd like
Example: given a user table and a user_status enum table, I'd like to be able to define CREATE FUNCTION user_status (user user) RETURNS user_status and use it in a computed column with the correct type.
Describe alternatives you've considered
Non-computed column kept up to date with an update trigger at the SQL level: I'd rather not persist derived data. This is also unworkable if the computation is based on values in other tables.
Postgres-level generated columns: suffers from the same limitation (can't use data from other tables).
Use a custom scalar computed field and override the type in the generated code in codegen.yml: works if you're using graphql-codegen, and might be what we'll go for
If the feature is approved, would you be willing to submit a PR?
I'd need substantial guidance, but yes.
The text was updated successfully, but these errors were encountered:
Is your proposal related to a problem?
I would like to use computed fields to expose derived data, such as entity status (e.g. how far along is the user in a sign-up flow). With scalar computed fields, I have to use some loose type (usually text or numeric) instead of some kind of table-based enum.
Describe the solution you'd like
Example: given a
user
table and auser_status
enum table, I'd like to be able to defineCREATE FUNCTION user_status (user user) RETURNS user_status
and use it in a computed column with the correct type.Describe alternatives you've considered
codegen.yml
: works if you're usinggraphql-codegen
, and might be what we'll go forIf the feature is approved, would you be willing to submit a PR?
I'd need substantial guidance, but yes.
The text was updated successfully, but these errors were encountered: