refactor(update pipeline & builders): standardize Update struct, hooks, and fluent builder chaining - #78
Merged
Merged
Conversation
…s, and fluent builder chaining 1- Add <Model>Update struct with optional pointer fields and assignmentsTo<Model>Update converter for type-safe validation 2- Refactor executeUpdate(), runUpdate(), executeUpdateMany(), and executeUpdateManyAndReturn() to parse assignments upfront into <Model>Update and pass cols/vals down to statement runners 3- Unify predicates into allWhere inside executeUpdate() to pass down as a single slice to extension hooks and statement execution 4- Update CreateBuilder and CreateManyAndReturnBuilder to store selects/omits on the builder struct directly and return self pointer on Select() and Omit(), removing unnecessary wrapper structs for 0-allocation method chaining 5- Add model-specific Select() and Omit() on <Model>CreateBuilder and <Model>CreateManyAndReturnBuilder for order-independent builder chaining 6- Move loadRelation and relation SQL compilers from builders_create.gotpl into relations_runtime.gotpl to modularize runtime relation helpers
…d fluent builder chaining
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
1- Add {Model}Update struct with optional pointer fields and assignmentsToUpdate converter for type-safe validation
2- Refactor executeUpdate(), runUpdate(), executeUpdateMany(), and executeUpdateManyAndReturn() to parse assignments upfront into Update and pass cols/vals down to statement runners
3- Unify predicates into allWhere inside executeUpdate() to pass down as a single slice to extension hooks and statement execution
4- Update CreateBuilder and CreateManyAndReturnBuilder to store selects/omits on the builder struct directly and return self pointer on Select() and Omit(), removing unnecessary wrapper structs for 0-allocation method chaining
5- Add model-specific Select() and Omit() on CreateBuilder and CreateManyAndReturnBuilder for order-independent builder chaining
6- Move loadRelation and relation SQL compilers from builders_create.gotpl into relations_runtime.gotpl to modularize runtime relation helpers