-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fxcore): Added possibility to provide extra information
- Loading branch information
Showing
6 changed files
with
103 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package fxcore | ||
|
||
import ( | ||
"go.uber.org/fx" | ||
) | ||
|
||
// AsCoreExtraInfo registers extra information in the core. | ||
func AsCoreExtraInfo(name string, value string) fx.Option { | ||
return fx.Supply( | ||
fx.Annotate( | ||
NewFxExtraInfo(name, value), | ||
fx.As(new(*FxExtraInfo)), | ||
fx.ResultTags(`group:"core-extra-infos"`), | ||
), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package fxcore_test | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/ankorstore/yokai/fxcore" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestAsCoreExtraInfo(t *testing.T) { | ||
t.Parallel() | ||
|
||
result := fxcore.AsCoreExtraInfo("foo", "bar") | ||
|
||
assert.Equal(t, "fx.supplyOption", fmt.Sprintf("%T", result)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters