oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package conversation
2
3import (
4 "encoding/json"
5 "gorm.io/gorm"
6)
7
8// ReportEvents uses the current write transaction supplied by the composition root.
9func ReportEvents(tx *gorm.DB, assignment string, kinds []string) ([]json.RawMessage, error) {
10 query := tx.Where("assignment_id=?", assignment)
11 if len(kinds) > 0 {
12 query = query.Where("kind IN ?", kinds)
13 }
14 var rows []EventRecord
15 if err := query.Find(&rows).Error; err != nil {
16 return nil, err
17 }
18 bodies := make([]json.RawMessage, 0, len(rows))
19 for _, row := range rows {
20 bodies = append(bodies, json.RawMessage(row.Body))
21 }
22 return bodies, nil
23}
24