indexers

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Gen

func Gen[V any](indexFunc func(obj V) ([]string, error)) cache.IndexFunc

Gen creates a generic index function from one that expects a specific type.

func GetByKey

func GetByKey[T any](store cache.Store, key string) (*T, bool, error)

GetByKey fetches the given value from the generic store and converts it to the right type.

func List

func List[T any](items []interface{}, err error) ([]*T, error)

List converts a list of generic items to a specific type.

This function is intended to be used for values returned on cache.Store and cache.Indexer methods.

Types

type UnexpectedTypeError

type UnexpectedTypeError struct {
	Expected reflect.Type
	Actual   reflect.Type
}

UnexpectedTypeError is returned when an expected type did not match the actually returned type.

func (*UnexpectedTypeError) Error

func (u *UnexpectedTypeError) Error() string

Jump to

Keyboard shortcuts

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