Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: generate code, not just types #142

Open
scottbessler opened this issue Feb 13, 2023 · 1 comment
Open

feature request: generate code, not just types #142

scottbessler opened this issue Feb 13, 2023 · 1 comment

Comments

@scottbessler
Copy link

scottbessler commented Feb 13, 2023

Loving how zapatos does things. One thing I'm missing is the ability to also generate code/data about the schema beyond types (but of course, typed using the generated schema.d.ts).

A simple example is wanting to have an array/set of the column names for a table, as we store deleted rows in a _deleted table alongside a table for record-keeping/debugging. We accomplish this with something akin to:

with deleted_data as (delete from foo returning a,b,c,d)
insert into foo_deleted (a,b,c,d) select a,b,c,d from deleted_data

Using * isn't an option here, as we cant guarantee the column order between the 2 tables is identical.

Even beyond column names, I can imagine (optionally?) generating other schema info that can be used at runtime would be useful as well.

@jawj
Copy link
Owner

jawj commented Feb 15, 2023

Sounds interesting. I guess this might be accomplished with some additional hooks that could be imported from zapatos/generate? Can you envisage how you'd like that to work in your case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants