caveats

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Delta

type Delta struct {
	// Type is the type of this delta.
	Type DeltaType

	// ParameterName is the name of the parameter to which this delta applies, if any.
	ParameterName string

	// PreviousType is the previous type of the parameter changed, if any.
	PreviousType *core.CaveatTypeReference

	// CurrentType is the current type of the parameter changed, if any.
	CurrentType *core.CaveatTypeReference
}

Delta holds a single change of a caveat.

type DeltaType

type DeltaType string

DeltaType defines the type of caveat deltas.

const (
	// CaveatAdded indicates that the caveat was newly added/created.
	CaveatAdded DeltaType = "caveat-added"

	// CaveatRemoved indicates that the caveat was removed.
	CaveatRemoved DeltaType = "caveat-removed"

	// CaveatCommentsChanged indicates that the comment(s) on the caveat were changed.
	CaveatCommentsChanged DeltaType = "caveat-comments-changed"

	// AddedParameter indicates that the parameter was added to the caveat.
	AddedParameter DeltaType = "added-parameter"

	// RemovedParameter indicates that the parameter was removed from the caveat.
	RemovedParameter DeltaType = "removed-parameter"

	// ParameterTypeChanged indicates that the type of the parameter was changed.
	ParameterTypeChanged DeltaType = "parameter-type-changed"

	// CaveatExpressionChanged indicates that the expression of the caveat has changed.
	CaveatExpressionChanged DeltaType = "expression-has-changed"
)

type Diff

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

Diff holds the diff between two caveats.

func DiffCaveats

func DiffCaveats(existing *core.CaveatDefinition, updated *core.CaveatDefinition) (*Diff, error)

DiffCaveats performs a diff between two caveat definitions. One or both of the definitions can be `nil`, which will be treated as an add/remove as applicable.

func (Diff) Deltas

func (cd Diff) Deltas() []Delta

Deltas returns the deltas between the two caveats.

Jump to

Keyboard shortcuts

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