MCPcopy Create free account
hub / github.com/canopyclimate/golive / writeDynamic

Method writeDynamic

internal/tmpl/tree.go:207–220  ·  view source on GitHub ↗
(d any)

Source from the content-addressed store, hash-verified

205}
206
207func (cw *countWriter) writeDynamic(d any) {
208 if cw.err != nil {
209 return
210 }
211 switch d := d.(type) {
212 case string:
213 cw.writeJSONString(d)
214 case *Tree:
215 // TODO - we want to include statics and diff them out elsewhere
216 d.writeTo(cw)
217 default:
218 panic(fmt.Sprintf("unexpected type of Dynamic: %T, want string or *Tree, value is: %v", d, d))
219 }
220}
221
222// WriteTo writes a JSON representation of the tree to w.
223func (t *Tree) WriteTo(w io.Writer) (written int64, err error) {

Callers 1

writeToMethod · 0.80

Calls 2

writeJSONStringMethod · 0.95
writeToMethod · 0.65

Tested by

no test coverage detected