deps

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package deps carries optional, typed dependencies from the assembly layer to the command factories. Keys are declared by the package that owns the value type, so the wiring layer (pkg/commands) never has to import — and therefore never links — the packages whose values it forwards.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get[T any](b *Bag, k Key[T]) (T, bool)

Get returns the value stored under k. The key identity already guarantees the type; the assertion exists only because the backing map is untyped.

func Has

func Has[T any](b *Bag, k Key[T]) bool

func Name

func Name[T any](k Key[T]) string

Name reports the declared name, used when logging a missing dependency.

func Set

func Set[T any](b *Bag, k Key[T], v T)

Set stores v under k. A nil Bag is a no-op so a half-built Deps cannot panic; use commands.Provide when the bag may not exist yet.

Types

type Bag

type Bag struct {
	// contains filtered or unexported fields
}

Bag maps key identity to value. Accessors are package functions because Go methods cannot declare type parameters.

func New

func New() *Bag

type Key

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

Key names a dependency of type T.

func NewKey

func NewKey[T any](name string) Key[T]

Jump to

Keyboard shortcuts

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