chore(simplification): Simplifying the patches #111
Merged
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.
Describe your changes
This pull request includes several changes to the
SQLPatch
functionality, focusing on improving code readability, refactoring methods, and updating documentation. The most important changes include removing unused imports, refactoring theloadDiff
method, adding a new method to handle embedded structs, and updating test cases to reflect these changes.Refactoring and Code Simplification:
loader.go
: Refactored theloadDiff
method to use a range loop and moved the embedded struct handling logic to a new methodhandleEmbeddedStruct
. [1] [2]sql.go
: Simplified thepatchGen
method by introducing helper functionsdereferenceIfPointer
andensureStruct
, and refactored the loop to use a range loop. [1] [2]Documentation Updates:
README.md
: Updated the description forincludeZeroValues
andincludeNilValues
to reflect that they are used in thePatch
method instead ofNewDiffSQLPatch
.Test Cases:
sql_test.go
: Updated test cases to reflect changes in theSQLPatch
implementation, including changes to expected argument types and values. [1] [2]Removal of Unused Imports:
loader.go
andsql.go
: Removed unused imports to clean up the codebase. [1] [2]