registry

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefault

func GetDefault[T any](types map[any]T, key RegKey[reflect.Type], kindKey RegKey[reflect.Kind]) (obj T, found bool)

func GetKind

func GetKind[T any](types map[any]T, _ RegKey[reflect.Type], kindKey RegKey[reflect.Kind]) (obj T, found bool)

func GetKindDst

func GetKindDst[T any](types map[any]T, _ RegKey[reflect.Type], kindKey RegKey[reflect.Kind]) (obj T, found bool)

func GetKindSrc

func GetKindSrc[T any](types map[any]T, _ RegKey[reflect.Type], kindKey RegKey[reflect.Kind]) (obj T, found bool)

func GetType

func GetType[T any](types map[any]T, key RegKey[reflect.Type], _ RegKey[reflect.Kind]) (obj T, found bool)

func GetTypeDst

func GetTypeDst[T any](types map[any]T, key RegKey[reflect.Type], _ RegKey[reflect.Kind]) (obj T, found bool)

func GetTypeSrc

func GetTypeSrc[T any](types map[any]T, key RegKey[reflect.Type], _ RegKey[reflect.Kind]) (obj T, found bool)

Types

type Getter

type Getter[T any] = func(types map[any]T, key RegKey[reflect.Type], kindKey RegKey[reflect.Kind]) (T, bool)

type RegKey

type RegKey[T any] struct {
	Dst T
	Src T
}

type TypeRegistry

type TypeRegistry[T any] struct {
	// contains filtered or unexported fields
}

func NewTypeRegistry

func NewTypeRegistry[T any](get func(dst, src reflect.Type) []Getter[T]) *TypeRegistry[T]

func (*TypeRegistry[T]) Clear

func (reg *TypeRegistry[T]) Clear() int

func (*TypeRegistry[T]) Get

func (reg *TypeRegistry[T]) Get(dstTyp reflect.Type, srcTyp reflect.Type) (obj T, found bool)

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL