Advanced Usage
Type utilities and advanced patterns for the Query Builder
Type Utilities
The Database types use several advanced TypeScript utilities to provide enhanced type-safety:
DrainOuterGeneric<T>
- Helps with generic type handlingDeepPartial<T>
- Creates a deeply optional version of a type- Type constraints like
TTableName extends keyof TDatabaseSchema & string
These utilities ensure you get proper type checking and autocompletion when using the query builder.
Custom Expression Builders
Custom Model Extensions
Extending Type Definitions
When using the query builder with your database schema, you'll define your own schema types: