mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
gvar.Set方法返回旧的变量值
This commit is contained in:
@ -30,12 +30,14 @@ func New(value interface{}, safe...bool) *Var {
|
||||
return v
|
||||
}
|
||||
|
||||
func (v *Var) Set(value interface{}) {
|
||||
func (v *Var) Set(value interface{}) (old interface{}) {
|
||||
if v.safe {
|
||||
v.value.(*gtype.Interface).Set(value)
|
||||
old = v.value.(*gtype.Interface).Set(value)
|
||||
} else {
|
||||
old = v.value
|
||||
v.value = value
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (v *Var) Val() interface{} {
|
||||
|
||||
Reference in New Issue
Block a user