It sometimes makes sense to inline your queries instead of collecting them in separate SQL files.
PgTyped supports inlined queries using the
sql template literal.
To see how that works lets write some queries in
PgTyped parses your TS files, scanning them for
sql queries and generating corresponding TS interfaces in
We can now pass the
ISelectUserIdsQuery as a generic parameter to our query in
Note that for the
age column in the result PgTyped has also translated a Postgres column comment (
COMMENT ON COLUMN) to a TSDoc-style comment. This will appear as a tooltip in your editor if you inspect the relevant property.
For more information on writing queries in TS files checkout the SQL-in-TS guide.