Skip to content

feat(templates): updating get all template to take in filters using the patcher wherer interface#75

Merged
Jacobbrewer1 merged 1 commit intomainfrom
feat/get-all-filters
Jan 31, 2025
Merged

feat(templates): updating get all template to take in filters using the patcher wherer interface#75
Jacobbrewer1 merged 1 commit intomainfrom
feat/get-all-filters

Conversation

@Jacobbrewer1
Copy link
Copy Markdown
Owner

Describe your changes

This pull request includes significant changes to the templates/model.tmpl file, focusing on enhancing the GetAll function to support dynamic query building with optional WHERE clauses. The most important changes include renaming the function for clarity, adding support for WHERE clauses, and modifying the SQL query construction to be more flexible.

Enhancements to GetAll function:

  • Renamed GetAll{{ $struct }} to GetAll{{ $struct }}s to better indicate the function returns multiple rows.
  • Added an optional wheres parameter to the GetAll{{ $struct }}s function, allowing for dynamic WHERE clauses in the SQL query.
  • Modified the SQL query construction to use a strings.Builder for more flexible and efficient string concatenation.
  • Implemented logic to handle multiple WHERE conditions, including support for different WhereType (AND/OR) and appending query arguments dynamically.
  • Updated the database query execution to include the dynamically built query and its arguments.

@Jacobbrewer1 Jacobbrewer1 merged commit bee9e95 into main Jan 31, 2025
@Jacobbrewer1 Jacobbrewer1 deleted the feat/get-all-filters branch January 31, 2025 12:56
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 3, 2025

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant