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]: $inferSelect on a view #2610

Closed
Sparticuz opened this issue Jul 9, 2024 · 3 comments
Closed

[FEATURE]: $inferSelect on a view #2610

Sparticuz opened this issue Jul 9, 2024 · 3 comments
Labels
enhancement New feature or request qb/crud

Comments

@Sparticuz
Copy link

Describe what you want

$inferSelect works great on tables, but doesn't seem to exist on views. The following seems to work, however it would be really nice to just have $inferSelect available.

type CustomerView = InferModelFromColumns<
  typeof custView._.selectedFields,
  "select",
  { dbColumnNames: false }
>;
@Sparticuz Sparticuz added the enhancement New feature or request label Jul 9, 2024
@johtso
Copy link

johtso commented Nov 21, 2024

Is there any way to currently get types for the return value of a select on a view? Or would it need this to be implemented?

@coryvirok
Copy link

Is there any way to currently get types for the return value of a select on a view? Or would it need this to be implemented?

Not that I know of. I've just been creating new "tables" that have the columns in the view until this feature is implemented.

@AndriiSherman
Copy link
Member

This one was added in the latest for all validator packages
drizzle-zod@0.6.0
drizzle-valibot@0.3.0
drizzle-typebox@0.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request qb/crud
Projects
None yet
Development

No branches or pull requests

5 participants