DeterministicEventID derives a stable event id from the trigger context. Per design §5.1, the input formula per event type is: email.received: sha256(message_id || "|" || event_type) email.sent: sha256(message_id || "|" || event_type) pending_review/review_approved/review_rejected: sha256(pe
(parts ...string)
| 216 | // SMTP retries: the retried trigger produces the same id, and the |
| 217 | // outbox INSERT no-ops via ON CONFLICT (id) DO NOTHING. |
| 218 | func DeterministicEventID(parts ...string) string { |
| 219 | h := sha256.New() |
| 220 | for i, p := range parts { |
| 221 | if i > 0 { |
| 222 | h.Write([]byte("|")) |
| 223 | } |
| 224 | h.Write([]byte(p)) |
| 225 | } |
| 226 | sum := h.Sum(nil) |
| 227 | return "evt_" + hex.EncodeToString(sum[:16]) |
| 228 | } |