Default Ecto-backed Mailglass.SuppressionStore implementation.
check/2 performs the union lookup from CONTEXT.md §specifics:
SELECT 1 FROM mailglass_suppressions
WHERE tenant_id = $tenant_id
AND (
(scope = 'address' AND address = $recipient) OR
(scope = 'domain' AND address = $recipient_domain) OR
(scope = 'address_stream' AND address = $recipient AND stream = $stream)
)
AND (expires_at IS NULL OR expires_at > now())
LIMIT 1The UNIQUE index on (tenant_id, address, scope, COALESCE(stream, ''))
plus the secondary (tenant_id, address) index serve the OR-union
efficiently (Postgres chooses per-branch plans).
record/2 uses on_conflict: {:replace, [...]} to make admin
re-adds idempotent.