blob: 4f3f2f3d92f8f5fcafbbb930e12872a8bd124b3c (
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
25
26
27
28
|
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
}
func (base *AppVersion) IsValid() bool {
return base.MajorVersion != 0 || base.MinorVersion != 0 || base.Patch != 0
}
|