add query hint support

This commit is contained in:
Yuyang Gong 2019-03-21 18:53:26 +08:00
parent 8b07437717
commit 5d759aa0b2

View File

@ -60,6 +60,11 @@ func queryCallback(scope *Scope) {
if !scope.HasError() {
scope.db.RowsAffected = 0
if str, ok := scope.Get("gorm:query_hint"); ok {
scope.SQL = addExtraSpaceIfExist(fmt.Sprint(str)) + scope.SQL
}
if str, ok := scope.Get("gorm:query_option"); ok {
scope.SQL += addExtraSpaceIfExist(fmt.Sprint(str))
}