Documentation
¶
Index ¶
- Constants
- Variables
- 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")
)
Functions ¶
func GetDefault ¶
func GetKindDst ¶
func GetKindSrc ¶
func GetTypeDst ¶
Types ¶
type MethodsRegistry ¶ added in v1.0.6
type MethodsRegistry struct {
// contains filtered or unexported fields
}
func NewMethods ¶ added in v1.0.6
func NewMethods() *MethodsRegistry
func (*MethodsRegistry) For ¶ added in v1.0.6
func (m *MethodsRegistry) For(rv reflect.Value, methodNames []string, validChk ...func(reflect.Value, reflect.Method) error) (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 ¶ added in v1.0.6
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 ¶ added in v1.0.6
func (reg *TypeRegistry[T]) WithLock(l sync.Locker)
Click to show internal directories.
Click to hide internal directories.