Skip to content

Commit

Permalink
Merge pull request #225 from rebuy-de/digutil
Browse files Browse the repository at this point in the history
add digutil
  • Loading branch information
svenwltr authored Dec 23, 2024
2 parents 229e98b + 663d3be commit 3154a7f
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 3154a7f

Please sign in to comment.