Skip to content

Commit 70e89a1

Browse files
committed
Append callbacks instead overwriting
1 parent 86e878c commit 70e89a1

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

database/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func WithDeleteStatement(stmt DeleteStatement) DeleteOption {
8383
// WithOnDelete sets the callbacks for a successful DELETE operation.
8484
func WithOnDelete(onDelete ...OnSuccess[any]) DeleteOption {
8585
return func(opts *deleteOptions) {
86-
opts.onDelete = onDelete
86+
opts.onDelete = append(opts.onDelete, onDelete...)
8787
}
8888
}
8989

database/insert.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func WithInsertStatement(stmt InsertStatement) InsertOption {
182182
// WithOnInsert sets the onInsert callbacks for a successful INSERT statement.
183183
func WithOnInsert(onInsert ...OnSuccess[any]) InsertOption {
184184
return func(opts *insertOptions) {
185-
opts.onInsert = onInsert
185+
opts.onInsert = append(opts.onInsert, onInsert...)
186186
}
187187
}
188188

database/update.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func WithUpdateStatement(stmt UpdateStatement) UpdateOption {
107107
// WithOnUpdate sets the callback functions to be called after a successful UPDATE.
108108
func WithOnUpdate(onUpdate ...OnSuccess[any]) UpdateOption {
109109
return func(opts *updateOptions) {
110-
opts.onUpdate = onUpdate
110+
opts.onUpdate = append(opts.onUpdate, onUpdate...)
111111
}
112112
}
113113

database/upsert.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func WithUpsertStatement(stmt UpsertStatement) UpsertOption {
9999
// WithOnUpsert sets the callback functions to be called after a successful UPSERT.
100100
func WithOnUpsert(onUpsert ...OnSuccess[any]) UpsertOption {
101101
return func(opts *upsertOptions) {
102-
opts.onUpsert = onUpsert
102+
opts.onUpsert = append(opts.onUpsert, onUpsert...)
103103
}
104104
}
105105

0 commit comments

Comments
 (0)