Code
How diesel-rs/diesel is laid out, and where to start for common changes.
There is no import map for this report yet.
Where to start reading
- Repository root
- Repository root
- Likely public API
- Likely public API
- Likely start-up file
- Suggested starting pointAI
- Suggested starting pointAI
- Suggested starting pointAI
Find files for a task
AIAdd support for a new SQL function
- Define function type in diesel/src/expression/functions/mod.rs or specialized module (e.g., date_and_time.rs)
- Implement QueryFragment trait for the function to emit SQL, using diesel/src/expression/functions/helper_types.rs patterns
- Add extension trait in diesel/src/expression_methods/ to expose function as method on column expressions
- For database-specific implementations, add variant in backend query builders (e.g., diesel/src/mysql_like/query_builder/mod.rs)
Add a new backend database (e.g., new SQL dialect)
- Create new backend module at diesel/src/[backend_name]/ with backend.rs defining Backend trait implementation
- Implement Connection trait in [backend_name]/connection.rs with statement preparation and row deserialization
- Create query builder in [backend_name]/query_builder/query_fragment_impls.rs mapping Diesel AST to dialect-specific SQL
- Add backend feature gate to diesel/Cargo.toml and conditionally export in diesel/src/lib.rs
Add a new expression operator or type cast
- Define operator enum in diesel/src/expression/operators.rs and implement BinOp trait
- Add operator to diesel/src/macros/ops.rs to auto-generate trait implementations via macro expansion
- Implement QueryFragment for operator in backend-specific query builders (diesel/src/mysql_like/query_builder/mod.rs or similar)
- Expose operator via extension trait method in diesel/src/expression_methods/
Change the public API
Trace runtime behavior
Add or update tests
Change build or automation
RepoPilot lists up to 500 files, so a file missing here may still exist.
- Files marked “likely” are guessed from their names.