Documentation
¶
Overview ¶
Package comp provides concise generic utility functions for component handling.
Index ¶
- func AsConfig[T any](h component.Handle) (*T, error)
- func Get[T any](ctx context.Context, l component.Locator, name string) (T, error)
- func GetDefault[T any](ctx context.Context, l component.Locator) (T, error)
- func GetMap[T any](ctx context.Context, l component.Locator) (map[string]T, error)
- func GetWithFallback[T any](ctx context.Context, l component.Locator, name string) (T, error)
- func GetWithTag[T any](ctx context.Context, l component.Locator, tag string) (T, error)
- func IsReserved(s string) bool
- func IsValidIdentifier(s string) bool
- func Iter[T any](ctx context.Context, l component.Locator) iter.Seq2[string, T]
- func RequireTyped[T any](h component.Handle, purpose string) (T, error)
- func ValidateScope(l component.Locator, s component.Scope) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDefault ¶
GetDefault retrieves the default component from a locator and asserts its type.
func GetMap ¶
GetMap collects all components from the given locator as a map and asserts their type.
func GetWithFallback ¶
GetWithFallback retrieves a component by name, falling back to the default name if not found.
func GetWithTag ¶
GetWithTag retrieves a component by tag from a locator and asserts its type.
func IsReserved ¶
IsReserved checks if the metadata string is system-reserved.
func IsValidIdentifier ¶
IsValidIdentifier checks if the string is a valid identifier for Category, Scope or Tag.
func RequireTyped ¶
RequireTyped retrieves a requirement by purpose from a handle and asserts its type.
Types ¶
This section is empty.