MCPcopy Index your code
hub / github.com/DoNewsCode/core / Example

Function Example

otmongo/example_test.go:14–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12)
13
14func Example() {
15 if os.Getenv("MONGO_ADDR") == "" {
16 fmt.Println("set MONGO_ADDR to run this example")
17 return
18 }
19 c := core.New()
20 c.ProvideEssentials()
21 c.Provide(otmongo.Providers())
22 c.Invoke(func(mongo *mongo.Client) {
23 err := mongo.Ping(context.Background(), readpref.Nearest())
24 fmt.Println(err)
25 })
26 // Output:
27 // <nil>
28}

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected