Skip to content

Commit

Permalink
fix(patcher): Adding new method that exports the perform patch for th…
Browse files Browse the repository at this point in the history
…e differ methods (#30)

Adding new method that exports the perform patch for the differ methods
  • Loading branch information
Jacobbrewer1 authored Oct 10, 2024
1 parent cdb3091 commit 76902dc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ func PerformPatch(resource any, opts ...PatchOpt) (sql.Result, error) {
return sqlPatch.PerformPatch()
}

func PerformDiffPatch[T any](old, newT *T, opts ...PatchOpt) (sql.Result, error) {
sqlPatch, err := NewDiffSQLPatch(old, newT, opts...)
if err != nil {
return nil, fmt.Errorf("new diff sql patch: %w", err)
}

return sqlPatch.PerformPatch()
}

func (s *SQLPatch) PerformPatch() (sql.Result, error) {
if err := s.validatePerformPatch(); err != nil {
return nil, fmt.Errorf("validate perform patch: %w", err)
Expand Down

0 comments on commit 76902dc

Please sign in to comment.