def lg.fields
cswap-bend-cli@0.1.0.0 · view.bend:255
import cswap-bend-cli@0.1.0.0/view.bend as View
import Base
import cswap-bend-cli@0.1.0.0/json.bend as Json
import cswap-bend-cli@0.1.0.0/poll.bend as Poll
255def lg.fields(ok: Bool, +lg: Json.Json, +f: U32, +now: U32, +off: U32, j: Json.Json) -> Json.Json:
256 match ok:
257 case False{}:
258 j
259 case True{}:
260 Json.set("lastGoodAgeSeconds", Json.JNum{age_text(Poll.sub0(now, f))},
261 Json.set("lastGoodFetchedAt", jstr(ts(f)),
262 Json.set("lastGoodUsage", usage_to_json(lg, Some{f}, now, off), j)))