You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
345 B
20 lines
345 B
package schema
|
|
|
|
import (
|
|
"reflect"
|
|
"sync"
|
|
)
|
|
|
|
// sync pools
|
|
var (
|
|
normalPool sync.Map
|
|
poolInitializer = func(reflectType reflect.Type) FieldNewValuePool {
|
|
v, _ := normalPool.LoadOrStore(reflectType, &sync.Pool{
|
|
New: func() interface{} {
|
|
return reflect.New(reflectType).Interface()
|
|
},
|
|
})
|
|
return v.(FieldNewValuePool)
|
|
}
|
|
)
|