diff --git a/godoc.md b/godoc.md index d61ff77..85a9f0a 100644 --- a/godoc.md +++ b/godoc.md @@ -12,7 +12,6 @@ Package tagcmp provides image tag comparison operations\. - [Variables](<#variables>) - [func IsParsable(tag string) bool](<#func-isparsable>) -- [func UpgradeType(t Tag) int](<#func-upgradetype>) - [type ByTagAsc](<#type-bytagasc>) - [func (t ByTagAsc) Len() int](<#func-bytagasc-len>) - [func (t ByTagAsc) Less(i, j int) bool](<#func-bytagasc-less>) @@ -28,7 +27,11 @@ Package tagcmp provides image tag comparison operations\. - [func (t Tag) IsGreaterThan(tag Tag) bool](<#func-tag-isgreaterthan>) - [func (t Tag) IsLessThan(tag Tag) bool](<#func-tag-islessthan>) - [func (t Tag) String() string](<#func-tag-string>) - - [func (curTag Tag) UpgradeElement(newTag Tag) (Tag, error)](<#func-tag-upgradeelement>) + - [func (curTag Tag) UpgradeDelta(newTag Tag) (TagDelta, error)](<#func-tag-upgradedelta>) +- [type TagDelta](<#type-tagdelta>) + - [func ParseDelta(delta string) (TagDelta, error)](<#func-parsedelta>) + - [func (t TagDelta) String() string](<#func-tagdelta-string>) + - [func (d TagDelta) UpgradeType() int](<#func-tagdelta-upgradetype>) ## Variables @@ -71,14 +74,6 @@ func IsParsable(tag string) bool IsParsable determines if a tag is supported by this library -## func UpgradeType - -```go -func UpgradeType(t Tag) int -``` - -UpgradeType takes exit from UpgradeElemene and returns a numeric representation of upgrade or downgrade 1/\-1: patch 2/\-2: minor 4/\-4: major 0: no change - ## type ByTagAsc ByTagAsc sorts tags in ascending order where the last element is the latest tag\. @@ -140,8 +135,9 @@ type Tag struct { MissingMinor bool // whether or not the minor semver part was left out Patch string `json:",omitempty"` // patch semver part MissingPatch bool // whether or not he patch semver part was left out - Suffix string // tag suffix (e.g. "-alpine") + Suffix string // tag suffix (e.g. "-alpine") [would be release candidate in semver] UsesV bool // whether or not the tag uses the "v" prefix + Metadata string // metadata: what's after + and after the first "-" } ``` @@ -193,13 +189,45 @@ func (t Tag) String() string String formats a Tag correctly in string representation -### func \(Tag\) UpgradeElement +### func \(Tag\) UpgradeDelta ```go -func (curTag Tag) UpgradeElement(newTag Tag) (Tag, error) +func (curTag Tag) UpgradeDelta(newTag Tag) (TagDelta, error) ``` -UpgradeElement returns a Tag object which is the difference between an old and new tag It can contain negative numbers if comparing with an older tag\. +UpgradeDelta returns a TagDelta object which is the difference between an old and new tag It can contain negative numbers if comparing with an older tag\. + +## type TagDelta + +```go +type TagDelta struct { + Major int // major semver difference + Minor int // minor semver difference + Patch int // patch semver difference +} +``` + +### func ParseDelta + +```go +func ParseDelta(delta string) (TagDelta, error) +``` + +ParseDelta converts a tag difference in the format of X\, X\.Y or X\.Y\.Z where X\, Y\, Z are positive or negative integers or 0 + +### func \(TagDelta\) String + +```go +func (t TagDelta) String() string +``` + +### func \(TagDelta\) UpgradeType + +```go +func (d TagDelta) UpgradeType() int +``` + +UpgradeType takes exit from UpgradeElemene and returns a numeric representation of upgrade or downgrade 1/\-1: patch 2/\-2: minor 4/\-4: major 0: no change