Convert all fingerprints to int64 before/after database interaction

This commit is contained in:
Fabian Reinartz 2015-10-19 14:21:50 +02:00
parent aead14a99f
commit a515b22325

View File

@ -95,9 +95,11 @@ func (n *SQLNotifyInfo) Get(dest string, fps ...model.Fingerprint) ([]*types.Not
WHERE destination == $1 AND alert == $2
`, dest, fp)
var alertFP int64
var ni types.Notify
err := row.Scan(
&ni.Alert,
&alertFP,
&ni.SendTo,
&ni.Resolved,
&ni.Delivered,
@ -111,6 +113,8 @@ func (n *SQLNotifyInfo) Get(dest string, fps ...model.Fingerprint) ([]*types.Not
return nil, err
}
ni.Alert = model.Fingerprint(alertFP)
result = append(result, &ni)
}
@ -151,7 +155,7 @@ func (n *SQLNotifyInfo) Set(ns ...*types.Notify) error {
}
log.Debugln("inserting notify", ni)
if _, err := insert.Exec(
ni.Alert,
int64(ni.Alert),
ni.SendTo,
ni.Resolved,
ni.Delivered,
@ -375,7 +379,7 @@ func (a *SQLAlerts) Put(alerts ...*types.Alert) error {
fp := alert.Fingerprint()
// Retrieve all intersecting alerts and delete them.
olaps, err := overlap.Query(fp, alert.StartsAt, alert.EndsAt)
olaps, err := overlap.Query(int64(fp), alert.StartsAt, alert.EndsAt)
if err != nil {
tx.Rollback()
return err
@ -440,7 +444,7 @@ func (a *SQLAlerts) Put(alerts ...*types.Alert) error {
}
_, err = insert.Exec(
uint64(fp),
int64(fp),
string(labels),
string(annotations),
alert.StartsAt,