summaryrefslogtreecommitdiff
path: root/engine/Settings/AppVersion.go
blob: d21fd1a1b8135e33bacfb3e942c957c0a45a7cf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package settings

type AppVersion struct {
	MajorVersion uint
	MinorVersion uint
	Patch uint
	IsBeta bool
}

func (base *AppVersion) IsGreaterThan(other *AppVersion) bool {
	return base.MajorVersion > other.MajorVersion || base.MinorVersion > other.MinorVersion || base.Patch > other.Patch
}

func (base *AppVersion) IsEqualTo(other *AppVersion) bool {
	return base.MajorVersion == other.MajorVersion && base.MinorVersion == other.MinorVersion && base.Patch == other.Patch
}

func (base *AppVersion) IsLessThan(other *AppVersion) bool {
	return base.MajorVersion < other.MajorVersion && base.MinorVersion < other.MinorVersion && base.Patch < other.Patch
}

func (base *AppVersion) IsCompatible() bool {
	return Current.Version.MajorVersion >= base.MajorVersion && Current.Version.MinorVersion >= base.MinorVersion && Current.Version.Patch >= base.Patch
}