Documentation ¶
Index ¶
- func IncludesChanges(diffs *System[*DiffWithChangeReason]) bool
- type ChangeReason
- type Diff
- type DiffAction
- type DiffResult
- type DiffWithChangeReason
- type Existence
- type MergeDuplicatePathErr
- type Path
- type State
- type StateWithChangeReason
- type System
- func CalculateDiff(ctx context.Context, existing *System[*State], ...) (*System[*DiffWithChangeReason], error)
- func ConvertToRemovals(s *System[*State]) (*System[*StateWithChangeReason], error)
- func NewSystem[T Validatable](in map[Path]T) *System[T]
- func SimpleState(files map[string]string) *System[*State]
- func SystemMerge[T Validatable](systems ...*System[T]) (*System[T], error)
- func (f *System[T]) Add(path Path, state T) error
- func (f *System[T]) Get(path Path) T
- func (f *System[T]) IsTracked(path Path) bool
- func (f *System[T]) MarshalLogObject(e zapcore.ObjectEncoder) error
- func (f *System[T]) Paths() []Path
- func (f *System[T]) Remove(path Path) (T, bool)
- func (f *System[T]) RemoveAll(paths []Path)
- func (f *System[T]) RemoveTracked(path Path) error
- type Validatable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IncludesChanges ¶
func IncludesChanges(diffs *System[*DiffWithChangeReason]) bool
Types ¶
type ChangeReason ¶
type ChangeReason struct {
Reason string
}
type Diff ¶
type Diff struct { OldFileState *State NewFileState *State DiffResult DiffResult }
type DiffAction ¶
type DiffAction int
const ( DiffActionUnset DiffAction = iota DiffActionDelete // Delete the object DiffActionCreate // Create the object DiffActionUpdate // Update the object DiffActionNoChange // No change to the object )
func (DiffAction) String ¶
func (d DiffAction) String() string
type DiffResult ¶
type DiffResult struct { DiffAction DiffAction ModeToChangeTo *os.FileMode ContentsToChangeTo []byte }
func (*DiffResult) Validate ¶
func (r *DiffResult) Validate() error
type DiffWithChangeReason ¶
type DiffWithChangeReason struct { Diff *Diff ChangeReason *ChangeReason }
func (*DiffWithChangeReason) Validate ¶
func (d *DiffWithChangeReason) Validate() error
type MergeDuplicatePathErr ¶
type MergeDuplicatePathErr[T Validatable] struct { Path Path Value1 T Value2 T }
func (*MergeDuplicatePathErr[T]) Error ¶
func (e *MergeDuplicatePathErr[T]) Error() string
type StateWithChangeReason ¶
type StateWithChangeReason struct { State State ChangeReason *ChangeReason }
func (*StateWithChangeReason) Validate ¶
func (s *StateWithChangeReason) Validate() error
type System ¶
type System[T Validatable] struct { // contains filtered or unexported fields }
func CalculateDiff ¶
func CalculateDiff(ctx context.Context, existing *System[*State], desired *System[*StateWithChangeReason]) (*System[*DiffWithChangeReason], error)
func ConvertToRemovals ¶
func ConvertToRemovals(s *System[*State]) (*System[*StateWithChangeReason], error)
func NewSystem ¶ added in v1.1.0
func NewSystem[T Validatable](in map[Path]T) *System[T]
func SystemMerge ¶
func SystemMerge[T Validatable](systems ...*System[T]) (*System[T], error)
func (*System[T]) MarshalLogObject ¶
func (f *System[T]) MarshalLogObject(e zapcore.ObjectEncoder) error
func (*System[T]) RemoveTracked ¶
type Validatable ¶
type Validatable interface {
Validate() error
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.