github.com/systematiccaos/gorm@v1.22.6/callbacks/row.go (about) 1 package callbacks 2 3 import ( 4 "github.com/systematiccaos/gorm" 5 ) 6 7 func RowQuery(db *gorm.DB) { 8 if db.Error == nil { 9 BuildQuerySQL(db) 10 if db.DryRun { 11 return 12 } 13 14 if isRows, ok := db.Get("rows"); ok && isRows.(bool) { 15 db.Statement.Settings.Delete("rows") 16 db.Statement.Dest, db.Error = db.Statement.ConnPool.QueryContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...) 17 } else { 18 db.Statement.Dest = db.Statement.ConnPool.QueryRowContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...) 19 } 20 21 db.RowsAffected = -1 22 } 23 }