forked from mirror/gorm
Add InstantSet for DB
This commit is contained in:
parent
3af077ac46
commit
922395c965
4
main.go
4
main.go
|
@ -392,10 +392,10 @@ func (s *DB) Association(column string) *Association {
|
||||||
|
|
||||||
// Set set value by name
|
// Set set value by name
|
||||||
func (s *DB) Set(name string, value interface{}) *DB {
|
func (s *DB) Set(name string, value interface{}) *DB {
|
||||||
return s.clone().set(name, value)
|
return s.clone().InstantSet(name, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DB) set(name string, value interface{}) *DB {
|
func (s *DB) InstantSet(name string, value interface{}) *DB {
|
||||||
s.values[name] = value
|
s.values[name] = value
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
2
scope.go
2
scope.go
|
@ -364,7 +364,7 @@ func (scope *Scope) Exec() *Scope {
|
||||||
|
|
||||||
// Set set value by name
|
// Set set value by name
|
||||||
func (scope *Scope) Set(name string, value interface{}) *Scope {
|
func (scope *Scope) Set(name string, value interface{}) *Scope {
|
||||||
scope.db.set(name, value)
|
scope.db.InstantSet(name, value)
|
||||||
return scope
|
return scope
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue