Skip to content

Commit

Permalink
chore(utils): Adding example to a comment that explains how to use th…
Browse files Browse the repository at this point in the history
…e func (#80)

Adding example to a comment that explains how to use the func
  • Loading branch information
Jacobbrewer1 authored Jan 13, 2025
1 parent e348d1d commit 8d5b5fd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ func isPointerToStruct[T any](t T) bool {
// 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.
//
// Example:
//
// err := report.Patch(db, newReport)
// if patcher.IgnoreNoChangesErr(err) != nil {
// return err
// }
func IgnoreNoChangesErr(err error) error {
switch {
case errors.Is(err, ErrNoChanges):
Expand Down

0 comments on commit 8d5b5fd

Please sign in to comment.