Documentation ¶
Index ¶
- type Change
- type ChangeFilter
- type ChangeOperation
- type ChangeReaction
- type Changelog
- func (c Changelog) FilterDiffs(comp DifferenceFilter) Changelog
- func (c Changelog) FilterDiffsByKind(kind Kind) Changelog
- func (c Changelog) ForEach(f func(c Change) error) error
- func (c Changelog) ForEachDiffFiltered(operations ...DifferenceReaction) error
- func (c Changelog) ForEachFiltered(operations ...ChangeReaction) error
- func (cl Changelog) Print(out io.Writer)
- type Difference
- type DifferenceFilter
- type DifferenceOperation
- type DifferenceReaction
- type Kind
- type Operation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Change ¶
type Change struct { Context string `json:"context"` Diff []Difference `json:"diff"` Kind Kind Operation Operation // contains filtered or unexported fields }
Change encapsulates all differences between two apps and carries the information about the context those apps exist in the app tree.
func (Change) Filter ¶
func (c Change) Filter(f func(d Difference) bool) (ret Change)
Filter filters the differences of the Change with the return value of the given function
func (Change) FilterKind ¶
FilterKind filters the diffs of the change by its kind.
func (Change) ForEach ¶
func (c Change) ForEach(f DifferenceOperation) error
ForEach applies the function for each change in the changelog
Errors are concatenated
type ChangeOperation ¶
ChangeOperation applies an operation in a change and returns an error
type ChangeReaction ¶
type ChangeReaction struct {
// contains filtered or unexported fields
}
ChangeReaction is a struct that holds a filter and an operation to be applied on a Changelog. The filter determines which changess will be applied to and the operation defines what will be applied to each change.
func NewChangeKindReaction ¶
func NewChangeKindReaction(kind Kind, apply func(c Change) error) ChangeReaction
NewChangeKindReaction creates a ChangeOperation that filters per type.
See ChangeOperation
func NewChangeReaction ¶
func NewChangeReaction(filter ChangeFilter, apply ChangeOperation) ChangeReaction
NewChangeReaction creates a ChangeOperation for the given filter and apply function
See ChangeOperation
type Changelog ¶
type Changelog []Change
Changelog log of all changes between two app trees.
func (Changelog) FilterDiffs ¶
func (c Changelog) FilterDiffs(comp DifferenceFilter) Changelog
FilterDiffs filters the entries in the changelog by an arbitrary function
func (Changelog) FilterDiffsByKind ¶
FilterDiffsByKind filters the changelog by changes of a spefific kind or combination of kinds. To use a combination, just bitwise or the different kinds, so, if you want the changes on channels and apps, use
c.FilterDiffsByKind(AppKind|ChannelKind)
func (Changelog) ForEachDiffFiltered ¶
func (c Changelog) ForEachDiffFiltered(operations ...DifferenceReaction) error
ForEachDiffFiltered applies each operation on the diffs contained in the changelog.
The operations are applied only if the filters defined on them return true, and every filter is applied on each diff in the changelog.
Errors are concatenated
func (Changelog) ForEachFiltered ¶
func (c Changelog) ForEachFiltered(operations ...ChangeReaction) error
ForEachFiltered applies each operation on the changes contained in the changelog.
The operations are applied only if the filters defined on them return true, and every filter is applied on each change in the changelog.
Errors are concatenated.
type Difference ¶
type Difference struct { Field string `json:"field"` From string `json:"from"` To string `json:"to"` Kind Kind Name string Operation Operation }
Difference is the most basic diff structure, it represents a difference between two apps. The object carries information abaout what field differs from one app to another, the value of that field on the original app and the value of that field on the current app.
type DifferenceFilter ¶
type DifferenceFilter func(scope string, d Difference) bool
DifferenceFilter filters differnces
type DifferenceOperation ¶
type DifferenceOperation func(scope string, d Difference) error
DifferenceOperation applies a function in a difference and returns its error
type DifferenceReaction ¶
type DifferenceReaction struct {
// contains filtered or unexported fields
}
DifferenceReaction is a struct that holds a filter and an operation to be applied on a Changelog. The filter determines which differences will be applied to and the operation defines what will be applied to each difference.
func NewDifferenceKindReaction ¶
func NewDifferenceKindReaction(kind Kind, apply DifferenceOperation) DifferenceReaction
NewDifferenceKindReaction creates a DifferenceOperation that filters per type.
See DifferenceOperation
func NewDifferenceReaction ¶
func NewDifferenceReaction(filter DifferenceFilter, apply DifferenceOperation) DifferenceReaction
NewDifferenceReaction creates a DifferenceOperation for the given filter and apply function
See DifferenceOperation