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

feat(patch): defaulting to snake case naming of the resource object provided if no table name option has been provided #131

Merged
merged 3 commits into from
Mar 7, 2025

Conversation

Jacobbrewer1
Copy link
Owner

Describe your changes

This pull request includes changes to improve the handling of SQL patch generation and testing, as well as updates to the CI workflow configuration. The most important changes include modifying the Go setup in the CI workflow, enhancing the SQL patch generation logic to handle cases where no table name is provided, and adding comprehensive tests for utility functions.

Enhancements to SQL patch generation:

  • sql.go: Added logic to set the table name automatically if it is not provided in the patchGen method.
  • sql_test.go: Added new tests to verify the behavior when no table name is provided in TestNewSQLPatch_Success_NoTableProvided, TestGenerateSQL_Success_NoTableProvided, and TestNewDiffSQLPatch_Success_SqlGen_NoTableProvided. [1] [2] [3]

Utility function improvements:

  • utils.go: Enhanced dereferenceIfPointer and getValue functions to handle nil pointers safely. Added new functions getTableName and toSnakeCase to derive table names from struct types. [1] [2] [3]
  • utils_test.go: Added comprehensive tests for utility functions including isPointerToStruct, dereferenceIfPointer, ensureStruct, getTag, getValue, IsValidType, getTableName, and toSnakeCase.

CI workflow updates:

@Jacobbrewer1 Jacobbrewer1 changed the title defaulting to snake case naming of the resource object provided if no table name option has been provided feat(patch): defaulting to snake case naming of the resource object provided if no table name option has been provided Mar 7, 2025
@Jacobbrewer1 Jacobbrewer1 merged commit 4782374 into main Mar 7, 2025
6 checks passed
@Jacobbrewer1 Jacobbrewer1 deleted the feat/default-table-name branch March 7, 2025 11:29
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