diff --git a/pkg/digutil/types.go b/pkg/digutil/types.go new file mode 100644 index 0000000..002772f --- /dev/null +++ b/pkg/digutil/types.go @@ -0,0 +1,14 @@ +package digutil + +import "go.uber.org/dig" + +type Optional[T any] struct { + dig.In + Value *T `optional:"true"` +} + +func ProvideValue[T any](c *dig.Container, v T) error { + return c.Provide(func() T { + return v + }) +}