Skip to content

Add hooks, error handling, restructure and condense code#5

Merged
evanjt merged 82 commits intomainfrom
remove_old_code
Nov 26, 2025
Merged

Add hooks, error handling, restructure and condense code#5
evanjt merged 82 commits intomainfrom
remove_old_code

Conversation

@evanjt
Copy link
Owner

@evanjt evanjt commented Nov 24, 2025

Major cleanup reducing original codebase size by almost half while adding a modular hook system for better customisation in handler function overrides, error handling with ApiError with some security hardening.

Highlights

  • Hook system: #[crudcrate(create::one::pre = validate_fn)] syntax for lifecycle hooks
  • Batch operations: create_many and update_many with hook support
  • ApiError: Consistent error handling, allowing internal stdout trace logging for internal errors by default (impl From on DbErr), but customisability to allow custom client api-side error messages with status codes if needed (while maintaining separate message for internal logging). Fixes issue Improve error handling #3
  • Security: SQL injection fixes, pagination limits, input sanitisation

Removed

  • index_analysis module (use database-native tools instead)
  • Dead code: attributes.rs, join_strategies/, redundant examples

Breaking Changes

  • register_crud_analyser! macro removed
  • analyse_and_display_indexes() method removed from trait

See CHANGELOG.md for full details.

@codecov-commenter
Copy link

codecov-commenter commented Nov 24, 2025

Codecov Report

❌ Patch coverage is 81.58010% with 422 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.89%. Comparing base (9625474) to head (049bc56).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crudcrate/src/operations.rs 0.00% 65 Missing ⚠️
crudcrate-derive/src/codegen/joins/loading.rs 60.60% 39 Missing ⚠️
crudcrate-derive/src/fields/extraction.rs 63.41% 30 Missing ⚠️
crudcrate-derive/src/attribute_parser.rs 91.08% 27 Missing ⚠️
crudcrate-derive/src/codegen/models/shared.rs 81.69% 26 Missing ⚠️
crudcrate-derive/src/lib.rs 71.42% 24 Missing ⚠️
crudcrate/src/validation.rs 84.05% 22 Missing ⚠️
crudcrate-derive/src/fields/analysis.rs 72.97% 20 Missing ⚠️
crudcrate/src/filtering/conditions.rs 89.83% 18 Missing ⚠️
crudcrate/src/core/traits.rs 0.00% 16 Missing ⚠️
... and 19 more
Additional details and impacted files
@@             Coverage Diff             @@
##             main       #5       +/-   ##
===========================================
+ Coverage   62.22%   79.89%   +17.67%     
===========================================
  Files          25       34        +9     
  Lines        3031     3358      +327     
===========================================
+ Hits         1886     2683      +797     
+ Misses       1145      675      -470     
Flag Coverage Δ
unittests 79.89% <81.58%> (+17.67%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@evanjt evanjt merged commit 9399c73 into main Nov 26, 2025
8 checks passed
@evanjt evanjt deleted the remove_old_code branch November 26, 2025 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants