This repository contains comprehensive examples and demonstrations for rawsql-ts, a TypeScript library for type-safe SQL query building.
Basic usage examples demonstrating core rawsql-ts features:
- Dynamic JOIN and WHERE clause building
- Asynchronous operations
- Query result collection
- SQL formatting and parameter injection
Enterprise-grade implementation showcasing:
- Advanced type safety with runtime validation
- Performance comparisons with ORMs (Prisma)
- Clean architecture patterns
- Advanced database operations
Choose your development pattern and follow the complete workflow:
# For basic-examples
cd basic-examples
npm install
npm run switch:stable
npm run demo:appendJoin
# For infrastructure-layer-demo
cd infrastructure-layer-demo
npm install
npm run switch:stable
npm run demo:findById
# For basic-examples
cd basic-examples
npm install
npm run switch:dev
npm run demo:appendJoin
# For infrastructure-layer-demo
cd infrastructure-layer-demo
npm install
npm run switch:dev
npm run demo:findById
Requirements for Pattern 2: rawsql-ts source code must be available at ../../rawsql-ts
relative to this repository.
- Clone this repository
- Navigate to the desired example directory
- Install dependencies:
npm install
- Choose rawsql-ts version:
- For production use:
npm run switch:stable
- For testing new features:
npm run switch:dev
- For production use:
- Run examples as described in each directory's README
- Node.js 18 or higher
- For development version: rawsql-ts source code repository
Examples are extracted from the main rawsql-ts repository to provide focused demonstrations. When contributing:
- Keep examples simple and focused
- Include comprehensive documentation
- Test with both stable and development versions
- Follow the established directory structure