Documentation
¶
Overview ¶
Package preset knows the schemas of common platforms: where they keep personal data, how their tables link up, and which settings would let a staging copy act on real customers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Names = []string{"wordpress", "woocommerce", "magento2", "laravel"}
Names lists the presets that can be asked for by name.
Functions ¶
Types ¶
type MetaTable ¶
type MetaTable struct {
Key, Value string
Platform string
Keys map[string]*detect.Hint // known keys
Probe []string // keys worth reading directly if the sample misses them
HintFor func(key string) *detect.Hint // pattern-based hints
Label func(key string) string // maps raw keys to names, e.g. Magento attribute IDs
// Families are keys known to share a prefix, such as Ultimate Member's
// per-user caches. They are grouped and probed by prefix.
Families []detect.FamilyRule
// Settings marks a table that holds one row per key, such as
// wp_options, even when it lost its unique index.
Settings bool
// Primary marks the tables of the main site and the shared ones; a
// scan spends its budgets on them first.
Primary bool
}
MetaTable describes a key/value table such as wp_postmeta. Each key is judged on its own, as if it were a column.
type Querier ¶
type Querier interface {
QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
}
Querier is the part of *sql.DB the presets need.
type Result ¶
type Result struct {
Platforms []model.Platform
Columns map[string]map[string]*detect.Hint // table → lower-case column → hint
Meta map[string]*MetaTable
Actions map[string]TableAction
Relationships []model.Relationship
Prefixes []string
SideEffects []model.SideEffect
RowSubjects []RowSubject
Warnings []string
}
Result is everything the presets found.
type RowSubject ¶ added in v0.3.0
type RowSubject struct {
Table, Column string
// Where selects the rows. It is a constant written in the preset,
// never text from the database.
Where string
// IndexColumn must lead an index, so the rows are found without a
// full scan; without one the subject is skipped.
IndexColumn string
Hint *detect.Hint
}
RowSubject is a column whose data depends on the row, such as the title of a WordPress privacy request, which holds the requester's email.
type TableAction ¶
TableAction is advice for a whole table, e.g. to empty it in the copy.
Click to show internal directories.
Click to hide internal directories.