diff

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter added in v0.16.0

type Filter struct {
	Locales    []string    `json:"locales,omitzero"`
	Namespaces []string    `json:"namespaces,omitzero"`
	Keys       []string    `json:"keys,omitzero"`
	KeyPrefix  string      `json:"keyPrefix,omitzero"`
	Statuses   []KeyStatus `json:"statuses,omitzero"`
}

Filter restricts analysis before validation; summaries describe this scope.

type KeyDiff

type KeyDiff struct {
	Locale             string            `json:"locale"`
	Namespace          string            `json:"namespace"`
	Key                string            `json:"key"`
	Status             KeyStatus         `json:"status"`
	SourceValue        string            `json:"sourceValue,omitzero"`
	TargetValue        string            `json:"targetValue,omitzero"`
	SourceHash         string            `json:"sourceHash,omitzero"`
	TranslatedFromHash string            `json:"translatedFromHash,omitzero"`
	TargetHash         string            `json:"targetHash,omitzero"`
	SourceFilePath     string            `json:"sourceFilePath,omitzero"`
	TargetFilePath     string            `json:"targetFilePath,omitzero"`
	SourceValidation   []validate.Issue  `json:"sourceValidation,omitzero"`
	Validation         []validate.Issue  `json:"validation,omitzero"`
	Metadata           map[string]string `json:"metadata,omitzero"`
}

KeyDiff describes one source/target key comparison.

type KeyStatus

type KeyStatus string

KeyStatus classifies the relationship between source and target keys.

const (
	Current KeyStatus = "current"
	Missing KeyStatus = "missing"
	Stale   KeyStatus = "stale"
	Extra   KeyStatus = "extra"
	Invalid KeyStatus = "invalid"
	// SourceInvalid means the source cannot be validated under its selected policy.
	SourceInvalid KeyStatus = "source_invalid"
	Unknown       KeyStatus = "unknown"
)

Key diff statuses.

type PageInput added in v0.16.0

type PageInput struct {
	Filter
	pagination.Input
}

PageInput combines analysis filters with paging controls.

type Report

type Report struct {
	SourceIssues     []validate.Issue     `json:"sourceIssues,omitzero"`
	SourceIssueCount int                  `json:"sourceIssueCount,omitzero"`
	SourceLocale     string               `json:"sourceLocale"`
	TargetLocales    []string             `json:"targetLocales"`
	Summary          Summary              `json:"summary"`
	Items            []KeyDiff            `json:"items"`
	Warnings         []string             `json:"warnings,omitzero"`
	WarningsTotal    int                  `json:"warningsTotal,omitzero"`
	Page             *pagination.Metadata `json:"page,omitzero"`
}

Report contains locale diff analysis results.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service analyzes differences between source and target keys.

func NewService

func NewService(locales *locale.Service, stateService *state.Service, validator *validate.Service) *Service

NewService creates a project-scoped analyzer.

func (*Service) Analyze

func (s *Service) Analyze(ctx context.Context) (Report, error)

Analyze is the explicit full-detail path for local exports and internal callers.

func (*Service) Page added in v0.16.0

func (s *Service) Page(ctx context.Context, signer *security.RequestStateSigner, project string, in PageInput) (Report, error)

Page computes a bounded page; no full-detail result cache is retained.

func (*Service) Walk added in v0.16.0

func (s *Service) Walk(ctx context.Context, filter Filter, visit func(KeyDiff) error) (Report, error)

Walk visits sorted matching records and aggregates counts without retaining them. Filters are applied before validation. Summary counts describe the filtered scope.

func (*Service) WalkInventory added in v0.16.0

func (s *Service) WalkInventory(ctx context.Context, inv locale.Inventory, filter Filter, visit func(KeyDiff) error) (Report, error)

WalkInventory avoids loading a second inventory when generating reports.

type StatusCounts

type StatusCounts struct {
	SourceInvalid int `json:"sourceInvalid,omitzero"`
	Current       int `json:"current"`
	Missing       int `json:"missing"`
	Stale         int `json:"stale"`
	Extra         int `json:"extra"`
	Invalid       int `json:"invalid"`
	Unknown       int `json:"unknown"`
}

StatusCounts counts key statuses for one locale.

type Summary

type Summary struct {
	SourceInvalid int                     `json:"sourceInvalid,omitzero"`
	Total         int                     `json:"total"`
	Current       int                     `json:"current"`
	Missing       int                     `json:"missing"`
	Stale         int                     `json:"stale"`
	Extra         int                     `json:"extra"`
	Invalid       int                     `json:"invalid"`
	Unknown       int                     `json:"unknown"`
	ByLocale      map[string]StatusCounts `json:"byLocale,omitzero"`
}

Summary counts key diff statuses.

func Summarize

func Summarize(items []KeyDiff) Summary

Summarize counts key diff statuses across items.

func (*Summary) Add added in v0.16.0

func (s *Summary) Add(item KeyDiff)

Add counts one record without retaining its payload.

Jump to

Keyboard shortcuts

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