Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

semver state

Back to all declarations

Version

type

Version is a parsed semantic version. Build metadata is retained for display but, per the spec, is ignored when comparing precedence.

Value

semver.Version

submitted

*v0.Tree

submitted holds versions users have posted on-chain: version string -> submitter.

Open
OID
041494…5839:7
submitted details

Inspect pointer

Parse

func(s string) (semver.Version, .uverse.error)

Parse reads "vMAJOR.MINOR.PATCH\[-prerelease]\[+build]". The leading 'v' is optional. Numeric fields must be non-empty digit runs without leading zeros.

Open
OID
041494…5839:9
Parse details

Inspect func

Compare

func(a string, b string) int

Compare returns -1, 0, or +1 as a \< b, a == b, or a > b under semver precedence. Unparseable inputs sort after everything valid (and equal to each other), so Compare never panics.

Open
OID
041494…5839:11
Compare details

Inspect func

comparePre

func(a []string, b []string) int

comparePre implements SemVer §11: a version WITH a pre-release has lower precedence than the same version WITHOUT one.

Open
OID
041494…5839:12
comparePre details

Inspect func

compareIdent

func(a string, b string) int

compareIdent: numeric identifiers compare numerically and always rank below alphanumeric ones; alphanumerics compare in ASCII order.

Open
OID
041494…5839:13
compareIdent details

Inspect func

parseNum

func(s string) (int, bool)

parseNum accepts a non-empty run of ASCII digits with no leading zero (except "0" itself), returning the value and whether it qualified.

Open
OID
041494…5839:15
parseNum details

Inspect func

validPreIdent

func(s string) bool

validPreIdent allows \[0-9A-Za-z-] and rejects empty identifiers.

Open
OID
041494…5839:16
validPreIdent details

Inspect func

Submit

func(version string)

Submit stores a valid version on-chain, tagged with the caller's address, so Render("/sorted") can list everyone's submissions in precedence order.

Open
OID
041494…5839:18
Submit details

Inspect func

renderCompare

func(a string, b string) string
Open
OID
041494…5839:21
renderCompare details

Inspect func

describe

func(label string, s string) string
Open
OID
041494…5839:22
describe details

Inspect func

entry

type

entry pairs a parsed version with the address that submitted it.

Value

semver.entry

byPrecedence

type

byPrecedence sorts entries ascending. \`sort\` on-chain has no Slice helper, so we implement sort.Interface.

Value

semver.byPrecedence
Version : type =semver.Version
errBadVersion : *errors.errorString Inspect
submitted : *v0.Tree Inspect
Parse : func(s string) (semver.Version, .uverse.error) Inspect
Compare : func(a string, b string) int Inspect
comparePre : func(a []string, b []string) int Inspect
compareIdent : func(a string, b string) int Inspect
cmpInt : func(a int, b int) int Inspect
parseNum : func(s string) (int, bool) Inspect
validPreIdent : func(s string) bool Inspect
ufmt : func(n int) string Inspect
Submit : func(version string) Inspect
Render : func(path string) string Inspect
renderHome : func() string Inspect
renderCompare : func(a string, b string) string Inspect
describe : func(label string, s string) string Inspect
renderSorted : func() string Inspect
entry : type =semver.entry
byPrecedence : type =semver.byPrecedence
relSym : func(c int) string Inspect
word : func(c int) string Inspect
ufmtSigned : func(c int) string Inspect