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

fix(errors): Updating method name for handling err no changes #38

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ func (s *NewDiffSQLPatchSuite) TestNewDiffSQLPatch_Success_ignoreNoChanges() {
}

patch, err := NewDiffSQLPatch(&obj, &obj2)
s.NoError(IgnoreNoChanges(err))
s.NoError(IgnoreNoChangesErr(err))
s.Nil(patch)
}

Expand All @@ -439,7 +439,7 @@ func (s *NewDiffSQLPatchSuite) TestNewDiffSQLPatch_Success_ignoreNoChanges_wrapp

patch, err := NewDiffSQLPatch(&obj, &obj2)
if err != nil {
err = IgnoreNoChanges(fmt.Errorf("wrapped: %w", err))
err = IgnoreNoChangesErr(fmt.Errorf("wrapped: %w", err))
}
s.NoError(err)
s.Nil(patch)
Expand Down
4 changes: 2 additions & 2 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ func isPointerToStruct[T any](t T) bool {
return rv.Elem().Kind() == reflect.Struct
}

// IgnoreNoChanges ignores the ErrNoChanges error. This is useful when you want to ignore the error when no changes
// IgnoreNoChangesErr ignores the ErrNoChanges error. This is useful when you want to ignore the error when no changes
// were made. Please ensure that you are still handling the errors as needed. We will return a "nil" patch when there
// are no changes as the ErrNoChanges error is returned.
func IgnoreNoChanges(err error) error {
func IgnoreNoChangesErr(err error) error {
switch {
case errors.Is(err, ErrNoChanges):
return nil
Expand Down
Loading