Help us shape the future of Go! Take the 2026 Go Developer Survey

reputation

package
v0.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package reputation computes the deliverability rates of ADR 0011: complaint rate (over delivered mail since ADR 0053) and bounce rate (over sent) per (Workspace, Sending domain) over a trailing window.

The rates are flow rates by each Event's own timestamp, computed by a live windowed query over events (no rollup table). Each is exposed as the (numerator, denominator, rate) triple; the rate is undefined (nil) when the denominator is zero.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DomainRates

type DomainRates struct {
	Domain *ent.SendingDomain
	// Complaint is complaints / delivered (ADR 0053): undefined with no email.delivered Event in
	// the window, as for a Preset that reports no delivery.
	Complaint Rate
	// Bounce is hard bounces / sent. Soft (transient) bounces are not counted.
	Bounce Rate
}

DomainRates are the rates of one Sending domain.

type Module

type Module struct{}

Module reads the rates.

func New

func New() *Module

New builds the module.

func (*Module) Rates

func (m *Module) Rates(ctx context.Context, s *ent.Scoped, w Window) ([]DomainRates, error)

Rates returns the rates of every Sending domain of the workspace, archived ones too (ADR 0049: archiving never changes past figures) over the window. A domain with no traffic is still listed, with undefined rates.

type Rate

type Rate struct {
	Numerator   int
	Denominator int
	Rate        *float64
}

Rate is a numerator over a denominator. Rate is nil when Denominator is zero.

type Window

type Window struct {
	Since, Until time.Time
}

Window is the span the rates are over: events from Since up to, not including, Until.

func Trailing

func Trailing(d time.Duration) Window

Trailing is the window of the given length ending now.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL