Skip to content

Examples

You can find a complete example using ts-sql-query with PostgreSQL in the file PgExample.ts. You can browse the examples folder to see an example for each supported database using different ways to connect to it.

Running examples:

The first time you download the project:

npm install
npm run generate-prisma

To execute all examples:

npm run all-examples

This command will compile the project and execute the script located at scripts/run-all-examples.sh

Be aware

This command expects you to have docker running and Oracle instantclient-basic downloaded and configured the path in the script (see the script to get more details)

If you want to execute a single example (like SQLite):

npx ts-node ./src/examples/Sqlite3Example.ts

Be aware

All examples excepting SQLite require a specific docker image with the database running; see scripts/run-all-examples.sh for more details.