Skip to content

Commit

Permalink
fix(errors): Updating method name for handling err no changes (#38)
Browse files Browse the repository at this point in the history
Updating method name for handling err no changes
  • Loading branch information
Jacobbrewer1 authored Oct 18, 2024
1 parent 37a7ba8 commit 4c443ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
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

0 comments on commit 4c443ac

Please sign in to comment.