github.com/gogf/gf/v2@v2.7.4/container/gtype/gtype_any.go (about) 1 // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/gogf/gf. 6 7 package gtype 8 9 // Any is a struct for concurrent-safe operation for type any. 10 type Any = Interface 11 12 // NewAny creates and returns a concurrent-safe object for any type, 13 // with given initial value `value`. 14 func NewAny(value ...any) *Any { 15 t := &Any{} 16 if len(value) > 0 && value[0] != nil { 17 t.value.Store(value[0]) 18 } 19 return t 20 }