()
| 8 | type ReactionGroups []ReactionGroup |
| 9 | |
| 10 | func (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 | |
| 33 | type ReactionGroup struct { |
| 34 | Content string `json:"content"` |
nothing calls this directly
no outgoing calls
no test coverage detected