This is an example app using pgtyped
.
Example queries are stored in src/books/queries.sql
, src/users/queries.ts
and src/comments/queries.sql
.
Try starting PgTyped and editing them to see live query type generation.
npm install
- Save your config into
config.json
npx pgtyped -w -c config.json
- Clone the whole pgtyped monorepo into some directory.
git clone [email protected]:adelsz/pgtyped.git pgtyped
cd pgtyped/packages/example
npm install
npm run build
docker-compose run watch
- Try editing queries in the SQL and TS files and see how PgTyped handles it.
The dockerized setup isn't required and is included for convenience.
It creates a PostgreSQL DB, loading it with the schema and seed records defined in sql/schema.sql
.
After that it starts PgTyped in a separate container, connecting it to the DB.