Skip to content

Commit

Permalink
expose AddError via Dao interface (#744)
Browse files Browse the repository at this point in the history
* expose AddError via Dao interface

* fix: mutate existing db to propagate the error back
  • Loading branch information
YasserRabee authored Jul 4, 2023
1 parent f655e1a commit c229eb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions do.go
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,10 @@ func (d *DO) newResultSlicePointer() interface{} {
return reflect.New(reflect.SliceOf(reflect.PtrTo(d.modelType))).Interface()
}

func (d *DO) AddError(err error) error {
return d.underlyingDB().AddError(err)
}

func toColExprFullName(stmt *gorm.Statement, columns ...field.Expr) []string {
return buildColExpr(stmt, columns, field.WithAll)
}
Expand Down
2 changes: 2 additions & 0 deletions interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,6 @@ type Dao interface {
Scan(dest interface{}) error
Pluck(column field.Expr, dest interface{}) error
ScanRows(rows *sql.Rows, dest interface{}) error

AddError(err error) error
}

0 comments on commit c229eb9

Please sign in to comment.