MCPcopy Create free account
hub / github.com/DoNewsCode/core / Example

Function Example

otes/example_test.go:12–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10)
11
12func Example() {
13 if os.Getenv("ELASTICSEARCH_ADDR") == "" {
14 fmt.Println("set ELASTICSEARCH_ADDR to run example")
15 return
16 }
17 c := core.New(core.WithInline("log.level", "none"))
18 c.ProvideEssentials()
19 c.Provide(otes.Providers())
20 c.Invoke(func(esClient *elastic.Client) {
21 running := esClient.IsRunning()
22 fmt.Println(running)
23 })
24 // Output:
25 // true
26}

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
WithInlineFunction · 0.92
ProvidersFunction · 0.92
ProvideEssentialsMethod · 0.80
ProvideMethod · 0.80
InvokeMethod · 0.80

Tested by

no test coverage detected