func scanAppEvent(s postgres.Scanner) (*ct.AppEvent, error) { var event ct.AppEvent var typ string var data []byte err := s.Scan(&event.ID, &event.AppID, &event.ObjectID, &typ, &data, &event.CreatedAt) if err != nil { if err == sql.ErrNoRows { err = ErrNotFound } return nil, err } event.AppID = postgres.CleanUUID(event.AppID) event.ObjectType = ct.EventType(typ) event.Data = json.RawMessage(data) return &event, nil }
func scanEvent(s postgres.Scanner) (*ct.Event, error) { var event ct.Event var typ string var data []byte var appID *string err := s.Scan(&event.ID, &appID, &event.ObjectID, &typ, &data, &event.CreatedAt) if err != nil { if err == pgx.ErrNoRows { err = ErrNotFound } return nil, err } if appID != nil { event.AppID = *appID } if data == nil { data = []byte("null") } event.ObjectType = ct.EventType(typ) event.Data = json.RawMessage(data) return &event, nil }