MCPcopy Create free account
hub / github.com/cli/cli / MarshalJSON

Method MarshalJSON

api/reaction_groups.go:10–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8type ReactionGroups []ReactionGroup
9
10func (rg ReactionGroups) MarshalJSON() ([]byte, error) {
11 buf := bytes.Buffer{}
12 buf.WriteRune('[')
13 encoder := json.NewEncoder(&buf)
14 encoder.SetEscapeHTML(false)
15
16 hasPrev := false
17 for _, g := range rg {
18 if g.Users.TotalCount == 0 {
19 continue
20 }
21 if hasPrev {
22 buf.WriteRune(',')
23 }
24 if err := encoder.Encode(&g); err != nil {
25 return nil, err
26 }
27 hasPrev = true
28 }
29 buf.WriteRune(']')
30 return buf.Bytes(), nil
31}
32
33type ReactionGroup struct {
34 Content string `json:"content"`

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected