feat: Add support for query methods and dynamic query skipping in CrudRepository #2
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Description:
This PR introduces several enhancements to the
CrudRepositoryImplementationServiceto provide better support for dynamic query skipping and handling query methods with templates.Key Changes:
Skip Functions Mechanism:
skip_functionsinCrudRepositoryImplementationServiceto store a list of method names that should be skipped while building queries.add_skip_functionallows adding methods to this skip list.Dynamic Query Skipping:
_implemenmt_querymethod has been updated to check if a method is in theskip_functionslist. If so, it will skip processing that method, logging the action.Query Decorator:
Querydecorator to enable marking methods with a query template.BaseModelorlist[BaseModel], with proper handling of results from the database query.Session Management:
PySpringModel.create_session()for handling database sessions within theQuerydecorator to execute SQL queries.Benefits:
Querydecorator provides an easy way to attach SQL templates to methods and automatically handle session and return types.Additional Notes:
Querydecorator assumes theBaseModelclass has amodel_validatemethod for result parsing.Related Issues: