knex library
Knex Dart - SQL Query Builder
A batteries-included SQL query builder for Dart inspired by Knex.js. For documentation and examples, see knex_dart.dart
Classes
- AnalyticClause
-
Dart port of Knex.js
lib/query/analytic.js - Client
- Abstract base class for database clients
- ColumnBuilder
- A fluent builder for a column definition in a CREATE TABLE or ALTER TABLE statement.
- ForeignBuilder
- Fluent builder for foreign key constraints on TableBuilder.
- JoinClause
- JoinClause for complex JOIN ON conditions
- Knex
- Main Knex factory class — pure query-builder wrapper.
- KnexConfig
- Configuration for Knex instance
- Migration
- MigrationConfig
- Migration configuration
- Migrator
- OnConflictBuilder
- Fluent builder for ON CONFLICT / INSERT IGNORE / ON DUPLICATE KEY UPDATE
- PoolConfig
- Connection pool configuration
- QueryBuilder
- Query builder for constructing SQL queries
- QueryCompiler
- Query compiler that transforms QueryBuilder statements into SQL
- QueryErrorEvent
- Event emitted when a query fails
- QueryEvent
- Event emitted when a query is executed
- QueryResponseEvent
- Event emitted when a query succeeds
- Raw
- Represents a raw SQL query or expression
- Ref
- Column reference that should behave like a Raw fragment
- SchemaBuilder
- Schema builder for DDL operations.
- SeedConfig
- Seed configuration
- SqlString
- Represents a compiled SQL query with its bindings
- TableBuilder
- Table builder for defining table schema through a callback.
- Transaction
- Transaction class
- TransactionConfig
- Transaction configuration
Enums
- ColumnType
- Column data types (for schema builder)
- ComparisonOperator
- Comparison operators
- ConflictAction
- Conflict resolution strategies for ON CONFLICT
- ForeignKeyAction
- Foreign key actions
- IsolationLevel
- Transaction isolation levels
- JoinType
- Join types
- LockMode
- Row-level lock modes
- OrderDirection
- ORDER BY direction
- QueryMethod
- Enums for type-safe Knex operations
- WaitMode
- Lock wait modes
Extensions
- JsonQueryBuilder on QueryBuilder
- Extension adding JSON-specific querying capabilities to QueryBuilder.
Typedefs
-
BindingList
= List<
BindingValue?> - List of binding values
- BindingValue = Object?
- Value for SQL binding Can be String, num, bool, List, Map, DateTime, null
- ConnectionConfig = Object
- Type definitions for Knex Dart
- DatabaseConnection = dynamic
- Database connection Type depends on the driver (pg.Connection, mysql.Connection, etc.) Will be refined per-dialect in Phase 2
-
QueryContext
= Map<
String, dynamic> - Query context for post-processing
-
QueryResult
= List<
Map< String, dynamic> > - Result from a database query This is intentionally dynamic as different drivers return different types, but will be typed per-driver in Phase 2
- RawQueryResult = dynamic
- Raw query result (driver-specific) Will be refined per-dialect in Phase 2
Exceptions / Errors
- KnexConnectionException
- Exception thrown when connection cannot be acquired
- KnexException
- Base exception class for all Knex errors
- KnexMigrationException
- Exception thrown when migration fails
- KnexMigrationLockException
- Exception thrown when migration table is locked
- KnexQueryException
- Exception thrown for invalid query construction
- KnexTimeoutException
- Exception thrown when query times out
- KnexTransactionException
- Exception thrown when transaction fails