Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangedFile ¶
type ChangedFile struct {
Path string `json:"path"`
Diff string `json:"diff,omitzero"`
Changed bool `json:"changed"`
Written bool `json:"written,omitzero"`
}
ChangedFile describes changes made or previewed for a locale file.
type Conflict ¶
type Conflict struct {
Locale string `json:"locale,omitzero"`
Namespace string `json:"namespace,omitzero"`
FromKey string `json:"fromKey,omitzero"`
ToKey string `json:"toKey,omitzero"`
FilePath string `json:"filePath,omitzero"`
Reason string `json:"reason"`
}
Conflict describes a reason a rename could not proceed.
type ConflictPolicy ¶
type ConflictPolicy string
ConflictPolicy controls rename behavior when the destination exists.
const ( ConflictReject ConflictPolicy = "reject" ConflictOverwrite ConflictPolicy = "overwrite" ConflictSkip ConflictPolicy = "skip" )
Conflict policies for key rename operations.
type Plan ¶
type Plan struct {
Input RenameInput
Edits []fileEdit
StateUpdates []StateUpdate
Conflicts []Conflict
Warnings []string
}
Plan contains planned file edits and state updates for a rename.
type RenameInput ¶
type RenameInput struct {
Namespace string `json:"namespace" jsonschema:"namespace containing the key to rename"`
FromKey string `json:"fromKey" jsonschema:"existing flattened key path"`
ToKey string `json:"toKey" jsonschema:"new flattened key path"`
Locales []string `json:"locales,omitzero" jsonschema:"locales to update; empty means all locales"`
DryRun *bool `json:"dryRun,omitzero" jsonschema:"when true, preview changes without writing"`
Apply bool `json:"apply,omitzero" jsonschema:"must be true to write locale files and state"`
ConflictPolicy ConflictPolicy `json:"conflictPolicy,omitzero" jsonschema:"destination conflict policy: reject, overwrite, or skip"`
}
RenameInput configures a key rename operation.
func (RenameInput) DryRunValue ¶
func (in RenameInput) DryRunValue() bool
DryRunValue returns the effective dry-run setting.
func (RenameInput) NormalizedConflictPolicy ¶
func (in RenameInput) NormalizedConflictPolicy() ConflictPolicy
NormalizedConflictPolicy returns the requested policy or the default.
type RenameOutput ¶
type RenameOutput struct {
DryRun bool `json:"dryRun"`
Planned int `json:"planned"`
Renamed int `json:"renamed"`
ChangedFiles []ChangedFile `json:"changedFiles"`
StateUpdates []StateUpdate `json:"stateUpdates,omitzero"`
Conflicts []Conflict `json:"conflicts,omitzero"`
Warnings []string `json:"warnings,omitzero"`
}
RenameOutput describes the result of a key rename operation.
type Service ¶
type Service struct {
Notifier Notifier
// contains filtered or unexported fields
}
Service performs key operations on locale files and state.
func NewService ¶
func NewService(configService *config.Service, guard *fsutil.Guard, localeService *locale.Service, stateService *state.Service) *Service
NewService creates a key operations service.
func (*Service) PlanRename ¶
PlanRename plans file edits and state updates for a key rename.
func (*Service) Rename ¶
func (s *Service) Rename(ctx context.Context, in RenameInput) (RenameOutput, error)
Rename renames a translation key across locale files and state.