Documentation
¶
Index ¶
- Constants
- Variables
- func For(rv reflect.Value, methodNames []string, ...) (rec reflect.Value, rm *reflect.Method, err error)
- func GetDefault[T any](types map[any]T, key RegKey[reflect.Type], kindKey RegKey[reflect.Kind]) (obj T, found bool)
- func GetKind[T any](types map[any]T, _ RegKey[reflect.Type], kindKey RegKey[reflect.Kind]) (obj T, found bool)
- func GetKindDst[T any](types map[any]T, _ RegKey[reflect.Type], kindKey RegKey[reflect.Kind]) (obj T, found bool)
- func GetKindSrc[T any](types map[any]T, _ RegKey[reflect.Type], kindKey RegKey[reflect.Kind]) (obj T, found bool)
- func GetType[T any](types map[any]T, key RegKey[reflect.Type], _ RegKey[reflect.Kind]) (obj T, found bool)
- func GetTypeDst[T any](types map[any]T, key RegKey[reflect.Type], _ RegKey[reflect.Kind]) (obj T, found bool)
- func GetTypeSrc[T any](types map[any]T, key RegKey[reflect.Type], _ RegKey[reflect.Kind]) (obj T, found bool)
- type Flag
- type Getter
- type MethodsRegistry
- type RegKey
- type TypeRegistry
- func (reg *TypeRegistry[T]) Clear() int
- func (reg *TypeRegistry[T]) Clone() *TypeRegistry[T]
- func (reg *TypeRegistry[T]) Get(dstTyp reflect.Type, srcTyp reflect.Type) (obj T, found bool)
- func (reg *TypeRegistry[T]) InterfaceRegister(iface reflect.Type, scan T) (overwrite bool)
- func (reg *TypeRegistry[T]) Register(dstType reflect.Type, srcOrT ...any) (overwrite bool)
- func (reg *TypeRegistry[T]) RegisterKind(dstKind, srcKind reflect.Kind, checker T) (overwrite bool)
- func (reg *TypeRegistry[T]) WithLock(l sync.Locker)
Constants ¶
View Source
const (
CodeNotFound errors.GoCode = "NotFound"
)
Variables ¶
View Source
var (
ErrNotFound errors.AbstractError[errors.Error] = errors.New(CodeNotFound, "not found")
)
View Source
var METHODS = NewMethods(512)
Functions ¶
func GetDefault ¶
func GetKindDst ¶
func GetKindSrc ¶
func GetTypeDst ¶
Types ¶
type MethodsRegistry ¶
type MethodsRegistry struct {
// contains filtered or unexported fields
}
func NewMethods ¶
func NewMethods(initSize int) *MethodsRegistry
func (*MethodsRegistry) CoolDown ¶
func (m *MethodsRegistry) CoolDown()
Clears the cache and returns the total count of cleared items
func (*MethodsRegistry) For ¶
func (m *MethodsRegistry) For(rv reflect.Value, methodNames []string, validChk ...func(reflect.Value, *reflect.Method) error) (rec reflect.Value, rm *reflect.Method, err error)
Look for multiple methods for this type, cache the first one found for future uses.
This cache cannot store multiple methods per type, and will always yield the cached result.
type TypeRegistry ¶
type TypeRegistry[T any] struct { // contains filtered or unexported fields }
func NewTypeRegistry ¶
func (*TypeRegistry[T]) Clear ¶
func (reg *TypeRegistry[T]) Clear() int
func (*TypeRegistry[T]) Clone ¶
func (reg *TypeRegistry[T]) Clone() *TypeRegistry[T]
func (*TypeRegistry[T]) InterfaceRegister ¶
func (reg *TypeRegistry[T]) InterfaceRegister(iface reflect.Type, scan T) (overwrite bool)
func (*TypeRegistry[T]) Register ¶
func (reg *TypeRegistry[T]) Register(dstType reflect.Type, srcOrT ...any) (overwrite bool)
func (*TypeRegistry[T]) RegisterKind ¶
func (reg *TypeRegistry[T]) RegisterKind(dstKind, srcKind reflect.Kind, checker T) (overwrite bool)
func (*TypeRegistry[T]) WithLock ¶
func (reg *TypeRegistry[T]) WithLock(l sync.Locker)
Click to show internal directories.
Click to hide internal directories.