Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(simplification): Simplifying the patches #111

Merged
merged 5 commits into from
Feb 10, 2025

Conversation

Jacobbrewer1
Copy link
Owner

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 the loadDiff method, adding a new method to handle embedded structs, and updating test cases to reflect these changes.

Refactoring and Code Simplification:

  • loader.go: Refactored the loadDiff method to use a range loop and moved the embedded struct handling logic to a new method handleEmbeddedStruct. [1] [2]
  • sql.go: Simplified the patchGen method by introducing helper functions dereferenceIfPointer and ensureStruct, and refactored the loop to use a range loop. [1] [2]

Documentation Updates:

  • README.md: Updated the description for includeZeroValues and includeNilValues to reflect that they are used in the Patch method instead of NewDiffSQLPatch.

Test Cases:

  • sql_test.go: Updated test cases to reflect changes in the SQLPatch implementation, including changes to expected argument types and values. [1] [2]

Removal of Unused Imports:

  • loader.go and sql.go: Removed unused imports to clean up the codebase. [1] [2]

@Jacobbrewer1 Jacobbrewer1 merged commit 0337e43 into main Feb 10, 2025
6 checks passed
@Jacobbrewer1 Jacobbrewer1 deleted the chore/simpolification branch February 10, 2025 08:55
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.

1 participant