docs: update godoc [ci skip]

This commit is contained in:
decentral1se 2021-10-12 00:07:50 +02:00
parent 4f27c74467
commit 3cac15cba2
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 42 additions and 14 deletions

View File

@ -12,7 +12,6 @@ Package tagcmp provides image tag comparison operations\.
- [Variables](<#variables>) - [Variables](<#variables>)
- [func IsParsable(tag string) bool](<#func-isparsable>) - [func IsParsable(tag string) bool](<#func-isparsable>)
- [func UpgradeType(t Tag) int](<#func-upgradetype>)
- [type ByTagAsc](<#type-bytagasc>) - [type ByTagAsc](<#type-bytagasc>)
- [func (t ByTagAsc) Len() int](<#func-bytagasc-len>) - [func (t ByTagAsc) Len() int](<#func-bytagasc-len>)
- [func (t ByTagAsc) Less(i, j int) bool](<#func-bytagasc-less>) - [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) IsGreaterThan(tag Tag) bool](<#func-tag-isgreaterthan>)
- [func (t Tag) IsLessThan(tag Tag) bool](<#func-tag-islessthan>) - [func (t Tag) IsLessThan(tag Tag) bool](<#func-tag-islessthan>)
- [func (t Tag) String() string](<#func-tag-string>) - [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 ## Variables
@ -71,14 +74,6 @@ func IsParsable(tag string) bool
IsParsable determines if a tag is supported by this library 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 ## type ByTagAsc
ByTagAsc sorts tags in ascending order where the last element is the latest tag\. 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 MissingMinor bool // whether or not the minor semver part was left out
Patch string `json:",omitempty"` // patch semver part Patch string `json:",omitempty"` // patch semver part
MissingPatch bool // whether or not he patch semver part was left out 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 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 String formats a Tag correctly in string representation
### func \(Tag\) UpgradeElement ### func \(Tag\) UpgradeDelta
```go ```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