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

Do not override existing types #363

Open
gajus opened this issue Dec 19, 2021 · 4 comments
Open

Do not override existing types #363

gajus opened this issue Dec 19, 2021 · 4 comments

Comments

@gajus
Copy link
Collaborator

gajus commented Dec 19, 2021

Related to this:

#362

I want to override types for a specific query.

Expected

I expect that if I provide a custom type to sql tagged template, then then typegen won't override it.

Actual

typegen always overrides sql types.

@mmkal
Copy link
Owner

mmkal commented Dec 20, 2021

I usually get around this with aliasing const _sql = sql, does that work? It might be tricky coming up with a reliable way to tell if a type is generated or hand-written.

@danielrearden
Copy link

What about checking for a comment in the query that would cause typegen to ignore it altogether?

@mmkal
Copy link
Owner

mmkal commented Feb 1, 2022

What's the advantage of that over aliasing sql? To be clear, the disadvantages in my mind are: steeper learning curve, more magic, less intuitive usage, more complex implementation.

If the only rule a user needs to remember is ”slonik-typegen affects sql" then the escape hatch follows naturally.

@janpaepke
Copy link
Collaborator

hey guys, you'll be happy to hear, we're working on both of these issues ignoring queries from extraction (without renaming the literal) as well as preserving custom type enhancements.

Your feedback on both proposals is very welcome.

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

No branches or pull requests

4 participants