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

Function Example

cron/example_test.go:29–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27}
28
29func Example() {
30 c := core.Default(core.WithInline("log.level", "none"))
31 c.Provide(observability.Providers())
32 c.Provide(
33 di.Deps{func() *cron.Cron {
34 return cron.New(cron.Config{EnableSeconds: true})
35 }},
36 )
37
38 c.AddModuleFunc(NewCronModule)
39 ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
40 defer cancel()
41
42 c.Serve(ctx)
43 // Output:
44 // I am a cron
45}

Callers

nothing calls this directly

Calls 7

DefaultFunction · 0.92
WithInlineFunction · 0.92
ProvidersFunction · 0.92
NewFunction · 0.92
ProvideMethod · 0.80
AddModuleFuncMethod · 0.80
ServeMethod · 0.80

Tested by

no test coverage detected