MCPcopy
hub / github.com/yusing/godoxy / MarshalJSON

Method MarshalJSON

internal/idlewatcher/debug.go:14–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12}
13
14func (w watcherDebug) MarshalJSON() ([]byte, error) {
15 state := w.state.Load()
16 return strutils.MarshalJSON(map[string]any{
17 "name": w.Name(),
18 "state": map[string]string{
19 "status": string(state.status),
20 "ready": strconv.FormatBool(state.ready),
21 "err": fmtErr(state.err),
22 },
23 "expires": strutils.FormatTime(w.expires()),
24 "last_reset": strutils.FormatTime(w.lastReset.Load()),
25 "config": w.cfg,
26 })
27}
28
29func Watchers() iter.Seq2[string, watcherDebug] {
30 return func(yield func(string, watcherDebug) bool) {

Callers

nothing calls this directly

Calls 4

fmtErrFunction · 0.85
LoadMethod · 0.80
expiresMethod · 0.80
NameMethod · 0.65

Tested by

no test coverage detected