diff options
Diffstat (limited to 'engine/Settings/AppVersion.go')
| -rw-r--r-- | engine/Settings/AppVersion.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/engine/Settings/AppVersion.go b/engine/Settings/AppVersion.go new file mode 100644 index 0000000..d21fd1a --- /dev/null +++ b/engine/Settings/AppVersion.go @@ -0,0 +1,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 +} |
