diff --git a/callback_query.go b/callback_query.go index 4538b272..5daa5fec 100644 --- a/callback_query.go +++ b/callback_query.go @@ -21,7 +21,7 @@ func Query(scope *Scope) { dest = reflect.Indirect(reflect.ValueOf(value)) } - if orderBy, ok := scope.InstanceGet("gorm:order_by_primary_key"); ok { + if orderBy, ok := scope.Get("gorm:order_by_primary_key"); ok { if primaryKey := scope.PrimaryKey(); primaryKey != "" { scope.Search.Order(fmt.Sprintf("%v.%v %v", scope.QuotedTableName(), primaryKey, orderBy)) } diff --git a/main.go b/main.go index b66ceda3..e197a99c 100644 --- a/main.go +++ b/main.go @@ -193,14 +193,14 @@ func (s *DB) Assign(attrs ...interface{}) *DB { func (s *DB) First(out interface{}, where ...interface{}) *DB { newScope := s.clone().NewScope(out) newScope.Search.Limit(1) - return newScope.InstanceSet("gorm:order_by_primary_key", "ASC"). + return newScope.Set("gorm:order_by_primary_key", "ASC"). inlineCondition(where...).callCallbacks(s.parent.callback.queries).db } func (s *DB) Last(out interface{}, where ...interface{}) *DB { newScope := s.clone().NewScope(out) newScope.Search.Limit(1) - return newScope.InstanceSet("gorm:order_by_primary_key", "DESC"). + return newScope.Set("gorm:order_by_primary_key", "DESC"). inlineCondition(where...).callCallbacks(s.parent.callback.queries).db }