예제 #1
0
func (e *ElasticWReport) Commit(r *models.Report, p []*models.Problem) error {
	r.Update()
	_, err := e.client.Index().Index(e.indexName).Type(TypoReportName).BodyJson(r).Id(e.rid).Do()

	bulk := e.client.Bulk()
	e.PutToBulk(bulk, p)
	_, err = bulk.Do()
	if err != nil {
		r.Error = err.Error()
		_, err = e.client.Index().Index(e.indexName).Type(TypoReportName).BodyJson(r).Id(e.rid).Do()
	}
	return err
}
예제 #2
0
func (m *MemWriter) Commit(r *models.Report, p []*models.Problem) error {
	r.Update()
	r.Problems = append(r.Problems, p...)
	return nil
}