Documentation
¶
Overview ¶
Package erasure is the registry of where ReputeCast keeps a contact's personal data, so erasing a contact and exporting what is stored about one reach every table (review 2026-11 DP-1, DP-2).
Each package that stores personal data about contacts declares a Source: the tables and columns it holds, how to erase them, and what to export. internal/app collects the sources (wire_audience.go) and a test there fails when a table with personal-data columns is in no source and not exempted with a reason. The package imports nothing from ReputeCast but authz and i18n, so any package can register without an import cycle.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Batch ¶
Batch is the contacts of one workspace erased together.
type Export ¶
type Export struct {
Section string
SQL string
Needs authz.Permission
}
Export is one section of a contact's data export: a query whose rows are written as JSON objects, column by column. It gets $1 the contact id, $2 the workspace id, $3 the contact's address (lower-cased) and $4 the phone number. Needs, when set, is the permission a section also needs (paid membership needs earn:view); without it the section says so.
type Reason ¶
type Reason string
Reason says why contacts are erased; it travels with contact.erased.
type Refusal ¶
Refusal is contacts a source won't let go: a live paid subscription in Stripe, say. Message takes {n}, the number refused.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is every source, in a fixed order: sources by name, then the core source (the contacts table itself) last.
type Source ¶
type Source struct {
Name string
Tables []Table
// Guard, optional, names contacts that can't be erased now.
Guard func(ctx context.Context, tx pgx.Tx, b *Batch) (*Refusal, error)
// Erase removes the source's personal data for the batch. It runs before
// the contacts themselves are scrubbed, so the address still matches.
Erase func(ctx context.Context, tx pgx.Tx, b *Batch) error
Exports []Export
}
Source is one package's personal data about contacts.
type Subject ¶
Subject is one contact being erased, read before anything is changed so sources can still match rows by the address or phone number.
type Table ¶
type Table struct {
Name string
// Action: "delete" (the rows go), "clear" (the columns are emptied),
// "anonymize" (identifying columns go, the rest stays for statistics).
Action string
// Columns are the personal-data columns the action removes.
Columns []string
// Kept are personal-data-looking columns left as they are, with why
// ("contact_id": "counts distinct clickers; the contact is scrubbed").
Kept map[string]string
}
Table is one table a source covers: the personal-data columns it clears (or the rows it deletes) and the ones it keeps on purpose, with why.