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
Generating types for composed template strings is going to be fun 😅
If you're up for it, we'll need to work on converting a string like the above to something we can pass to the SQL type generator.
So:
SELECT ${column} FROM ${table} ${condition} OR a=${"42"}
should be temporarily transformed to:
SELECT "a" FROM "a" WHERE a=? OR a=? OR a=?
at compile time and passed to the type-gen package. The TypeScript Compiler APIs let you inspect all the fragments that make up a template string and pull their type information. That should provide enough information to do the transform given sql.column("a"); would return a literal column type of "a". Same with table.
Values we can ignore (at least to start. Balues in non-value positions would pose a problem) and substitute ? in their place.
Generating types for composed template strings is going to be fun 😅
If you're up for it, we'll need to work on converting a string like the above to something we can pass to the SQL type generator.
So:
SELECT ${column} FROM ${table} ${condition} OR a=${"42"}
should be temporarily transformed to:
SELECT "a" FROM "a" WHERE a=? OR a=? OR a=?
at compile time and passed to the type-gen package. The TypeScript Compiler APIs let you inspect all the fragments that make up a template string and pull their type information. That should provide enough information to do the transform given
sql.column("a")
; would return a literal column type of "a". Same with table.Values we can ignore (at least to start. Balues in non-value positions would pose a problem) and substitute
?
in their place.We'd do this in a future PR.
Originally posted by @tantaman in #4 (comment)
The text was updated successfully, but these errors were encountered: