2020-02-22 14:41:01 +03:00
|
|
|
package callbacks
|
|
|
|
|
2020-02-22 15:57:29 +03:00
|
|
|
import (
|
2020-06-02 04:16:07 +03:00
|
|
|
"gorm.io/gorm"
|
2020-02-22 15:57:29 +03:00
|
|
|
)
|
2020-02-22 14:41:01 +03:00
|
|
|
|
|
|
|
func RawExec(db *gorm.DB) {
|
2020-05-31 18:55:56 +03:00
|
|
|
if db.Error == nil {
|
|
|
|
result, err := db.Statement.ConnPool.ExecContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...)
|
|
|
|
if err != nil {
|
|
|
|
db.AddError(err)
|
|
|
|
} else {
|
|
|
|
db.RowsAffected, _ = result.RowsAffected()
|
|
|
|
}
|
2020-02-22 14:41:01 +03:00
|
|
|
}
|
|
|
|
}
|