Documentation
¶
Overview ¶
Package fix contains functions for repairing the database data.
Index ¶
- Constants
- Variables
- func Magics(exec boil.ContextExecutor) error
- func MergeReleaser(ctx context.Context, exec boil.ContextExecutor, from, to string) (int64, error)
- func SyncFilesIDSeq(exec boil.ContextExecutor) error
- type DupEntry
- type DupFile
- type DupGroup
- type DupReport
- type Fix
- type List
- type NumFile
- type NumFiles
- type ReleaserCount
- type Repair
Constants ¶
const Trainer = "gamehack"
Variables ¶
var ErrInvalidMerge = fmt.Errorf("source and target releaser names must be non-empty and distinct")
ErrInvalidMerge is returned when merge source or destination releaser names are invalid.
var ErrRepair = errors.New("fix: invalid repair option")
Functions ¶
func Magics ¶ added in v0.17.0
func Magics(exec boil.ContextExecutor) error
Magics will set invalid file_magic_type to NULL. Invalid file_magic_type values are those that start with "ERROR: " or contain a "/" such as a mime-type.
func MergeReleaser ¶ added in v1.16.0
MergeReleaser renames all references of releaser "from" to "to" across group_brand_for and group_brand_by, clearing group_brand_by if both columns become identical.
func SyncFilesIDSeq ¶ added in v1.0.6
func SyncFilesIDSeq(exec boil.ContextExecutor) error
SyncFilesIDSeq will synchronize the files ID sequence with the current maximum ID.
This will only work with the correct database account permissions.
Types ¶
type DupEntry ¶ added in v1.15.4
type DupEntry struct {
Name string
RawName string
Display string
URI string
Kind string
Count int
Files []DupFile
}
DupEntry represents a single releaser candidate within a duplicate cluster.
type DupFile ¶ added in v1.16.0
DupFile represents an individual artifact file belonging to a minor duplicate entry.
type DupGroup ¶ added in v1.15.4
DupGroup represents a cluster of two or more potentially duplicate releaser names.
type DupReport ¶ added in v1.15.4
type DupReport struct {
TotalReleasers int
TotalClusters int
Tier1 []DupGroup
Tier2 []DupGroup
Tier3 []DupGroup
}
DupReport summarizes all detected duplicate clusters across confidence tiers.
func AnalyzeDuplicates ¶ added in v1.15.4
func AnalyzeDuplicates(rows []ReleaserCount) *DupReport
AnalyzeDuplicates runs the 3-tier in-memory clustering pipeline on a slice of releaser counts.
func Duplicates ¶ added in v1.15.4
Duplicates queries all distinct public releasers and clusters potential duplicates.
type List ¶ added in v1.14.0
func Replacements ¶ added in v1.14.0
func Replacements() List
Replacements returns a copy of the replacers List.
type NumFile ¶ added in v1.14.0
type NumFile struct {
ID int64 `boil:"id" json:"id"`
UUID string `boil:"uuid" json:"uuid"`
Filename string `boil:"suffix" json:"filename"`
ObfuscatedID string `boil:"-" json:"obfuscatedId"`
}
NumFile represents a file with a numeric suffix.
type NumFiles ¶ added in v1.14.0
type NumFiles struct {
Count int64 `boil:"-" json:"count"`
Files []NumFile `boil:"-" json:"files"`
}
NumFiles represents files that have numeric suffixes that need fixing.
type ReleaserCount ¶ added in v1.15.4
ReleaserCount holds a raw releaser name and its file count from the database.
type Repair ¶
type Repair int
Repair a column or type of data within the database.
func (Repair) Run ¶
func (r Repair) Run(ctx context.Context, sl *slog.Logger, db *sql.DB, exec boil.ContextExecutor) error
Run the database repair based on the repair option.
The exec boil context executor is required. The db sql DB pointer is optional for a VACUUM statement that cannot be used in a transaction block.