Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareCalVer ¶
CompareCalVer compares two CalVer strings numerically component-by-component, falling back to lexical comparison for any non-numeric component. Returns -1 if a < b, +1 if a > b, 0 if equal. Distinct from ParsedCalVer.Less, which requires strictly-canonical parsed CalVers; this is the lenient dotted-string comparator the build/tag paths use. A leading "v" (the git-tag form) is stripped before comparison, so semver-style tags ("v1.2.3") sort correctly against multi-digit majors ("v10.0.0") — the single comparator for both CalVer and git-tag strings (refs.CompareSemver delegates here).
Types ¶
type ParsedCalVer ¶
type ParsedCalVer struct {
Year int // calendar year (e.g. 2026)
Day int // day of year, 1-366
HHMM int // hour*100 + minute, 0-2359
}
ParsedCalVer is a parsed YYYY.DDD.HHMM calendar version. The same format that ComputeCalVer emits for image tags is, since the 2026-05 schema-versioning cutover, the schema-version stamp carried by every versioned YAML config. The declarative migration table is ordered by ParsedCalVer, and the load-time gate compares a file's version against LatestSchemaCalVer.
func LatestSchemaCalVer ¶
func LatestSchemaCalVer() ParsedCalVer
LatestSchemaCalVer is the HEAD schema CalVer (parsed) — every current-format versioned file is stamped to it and the load-time gate requires it. Named distinctly from the SchemaVersion string const it parses; sdk/kit re-exports it as kit.LatestSchemaVersion.
func MustCalVer ¶
func MustCalVer(s string) ParsedCalVer
MustCalVer parses a compile-time-constant CalVer literal, panicking on a malformed value. Used for the CUE-owned HEAD/floor consts (SchemaVersion / SchemaFloor), so a non-canonical literal that slipped past the strict #CanonCalVer CUE gate still fails fast at process start rather than silently mis-ordering the migration table.
func ParseCalVer ¶
func ParseCalVer(s string) (ParsedCalVer, bool)
ParseCalVer parses the CANONICAL CalVer string "YYYY.DDD.HHMM" — exactly a 4-digit year, a 3-digit zero-padded day-of-year, and a 4-digit zero-padded HHMM, separated by dots. It is EXTREMELY STRICT and has NO backward compatibility: every component must be the exact width, pure ASCII digits (no sign, no inner whitespace), within range (day 1-366, hour 0-23, minute 0-59). Anything else — the legacy integer "4", a non-padded "2026.45.830", an empty string, junk — returns ok=false. (Surrounding whitespace, a transport artifact of e.g. a `charly version` trailing newline, is trimmed before the format check.)
A false result is exactly what the schema gate and migration runner treat as "older than every real CalVer", so a non-canonical config flows into `charly migrate` and is re-stamped canonical.
Because the canonical form is fixed-width zero-padded, a plain alphanumeric (lexicographic) sort of CalVer strings is chronological (see ParsedCalVer.Less).
func SchemaFloorCalVer ¶
func SchemaFloorCalVer() ParsedCalVer
SchemaFloorCalVer is the oldest schema CalVer (parsed) `charly migrate` can migrate FROM. A config below it (or with a non-CalVer version) is unmigratable. Named distinctly from the SchemaFloor string const it parses; sdk/kit re-exports it as kit.SchemaFloor.
func (ParsedCalVer) Less ¶
func (c ParsedCalVer) Less(o ParsedCalVer) bool
Less reports whether c is chronologically before o. Because the canonical string form is fixed-width zero-padded, chronological order IS lexicographic order, so this is a plain string comparison.
func (ParsedCalVer) String ¶
func (c ParsedCalVer) String() string
String renders the canonical CalVer "YYYY.DDD.HHMM" — 4-digit year, 3-digit zero-padded day, 4-digit zero-padded HHMM. This is the ONLY form ParseCalVer accepts, so String∘Parse is the identity and a plain alphanumeric sort of these strings is chronological.