Example #1
0
func (sv SemVer) LessThanMajor(versionB SemVer) bool {
	majorA := semver.Version(sv).Major
	majorB := semver.Version(versionB).Major
	if majorA < majorB {
		return true
	}
	return false
}
Example #2
0
func (v *IgnitionVersion) UnmarshalJSON(data []byte) error {
	tv := semver.Version(*v)
	if err := json.Unmarshal(data, &tv); err != nil {
		return err
	}
	*v = IgnitionVersion(tv)
	return nil
}
Example #3
0
func (v *IgnitionVersion) unmarshal(unmarshal func(interface{}) error) error {
	tv := semver.Version(*v)
	if err := unmarshal(&tv); err != nil {
		return err
	}
	*v = IgnitionVersion(tv)
	return nil
}
Example #4
0
func (v IgnitionVersion) Validate() report.Report {
	if MaxVersion.Major > v.Major {
		return report.ReportFromError(ErrOldVersion, report.EntryError)
	}
	if MaxVersion.LessThan(semver.Version(v)) {
		return report.ReportFromError(ErrNewVersion, report.EntryError)
	}
	return report.Report{}
}
Example #5
0
func (v IgnitionVersion) AssertValid() error {
	if MaxVersion.Major > v.Major {
		return ErrOldVersion
	}
	if MaxVersion.LessThan(semver.Version(v)) {
		return ErrNewVersion
	}
	return nil
}
Example #6
0
func (v IgnitionVersion) MarshalJSON() ([]byte, error) {
	return semver.Version(v).MarshalJSON()
}
Example #7
0
func (sv SemVer) Empty() bool {
	return semver.Version(sv) == semver.Version{}
}
Example #8
0
func (sv SemVer) String() string {
	s := semver.Version(sv)
	return s.String()
}
Example #9
0
func (sv SemVer) LessThanExact(versionB SemVer) bool {
	vA := semver.Version(sv)
	vB := semver.Version(versionB)
	return vA.LessThan(vB)
}