Skip to content

Commit

Permalink
add digutil
Browse files Browse the repository at this point in the history
  • Loading branch information
svenwltr committed Dec 19, 2024
1 parent 229e98b commit 663d3be
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkg/digutil/types.go
Original file line number Diff line number Diff line change
@@ -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
})
}

0 comments on commit 663d3be

Please sign in to comment.