diff --git a/report.go b/report.go
index 7752c9c..6a1064e 100644
--- a/report.go
+++ b/report.go
@@ -3,6 +3,7 @@ package main
import (
"context"
_ "embed"
+ "encoding/json"
"errors"
"io"
"slices"
@@ -27,20 +28,13 @@ func ReportSince(ctx context.Context, w io.Writer, s Storage, t time.Time) error
}
return nil, errors.New("not impl")
},
- "null": func() any {
- return nil
- },
- "append": func(arr any, v any) (any, error) {
- if v == nil {
- return arr, nil
+ "json": func(foo string, args ...any) (any, error) {
+ switch foo {
+ case "Marshal":
+ b, err := json.Marshal(args[0])
+ return string(b), err
}
- switch arr := arr.(type) {
- case []any:
- return append(arr, v), nil
- case nil:
- return []any{v}, nil
- }
- return nil, errors.New("unknown type in append")
+ return nil, errors.New("not impl")
},
})
tmpl, err := tmpl.Parse(reportTMPL)
diff --git a/report.tmpl b/report.tmpl
index e0524cb..e6b2d8d 100644
--- a/report.tmpl
+++ b/report.tmpl
@@ -1,11 +1,52 @@
-