osmixtype

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2022 License: MIT Imports: 27 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Ranges = [...]string{
		Invalid:               "Invalid",
		AnyOs:                 "AnyOs",
		Windows:               "Windows",
		Unix:                  "Unix",
		Linux:                 "Linux",
		MacOs:                 "MacOs",
		Ubuntu:                "Ubuntu",
		Debian:                "Debian",
		ArchLinux:             "ArchLinux",
		FreeBsd:               "FreeBsd",
		Centos:                "Centos",
		RedHatEnterpriseLinux: "RedHatEnterpriseLinux",
		Docker:                "Docker",
		Android:               "Android",
	}

	BasicEnumImpl = enumimpl.New.BasicByte.UsingFirstItemSliceAliasMap(
		Invalid,
		Ranges[:],
		aliasMap)
)

Functions

func CurrentOsMixTypesMap added in v0.1.3

func CurrentOsMixTypesMap() map[Variant]bool

func CurrentOsTypesMustBePresent added in v0.1.3

func CurrentOsTypesMustBePresent(items ...Variant)

func CurrentOsTypesNotContainsError added in v0.1.3

func CurrentOsTypesNotContainsError(items ...Variant) error

func IsCentOs added in v0.1.3

func IsCentOs() bool

func IsCurrentOsTypesContains added in v0.1.3

func IsCurrentOsTypesContains(items ...Variant) bool

func IsDebian added in v0.3.6

func IsDebian() bool

func IsRedhat added in v0.1.3

func IsRedhat() bool

func IsRunningInDockerContainer added in v0.3.6

func IsRunningInDockerContainer() bool

IsRunningInDockerContainer

https://paulbradley.org/indocker/

docker creates a .dockerenv file at the root
of the directory tree inside the container.
if this file exists then the viewer is running
from inside a container so return true

func IsUbuntu added in v0.1.3

func IsUbuntu() bool

func NewWindowsSystemDetailGetter added in v0.1.3

func NewWindowsSystemDetailGetter() (windowsSysDetailDefiner, error)

func RangesInvalidErr

func RangesInvalidErr() error

Types

type OperatingSystemDetail added in v0.1.3

type OperatingSystemDetail struct {
	OsMixType       Variant
	Name            strtype.Variant         `json:"Name,omitempty"`            // eg. "CentOS Linux 7 (Core)",
	Vendor          strtype.Variant         `json:"Vendor,omitempty"`          // eg. ubuntu, centos
	LinuxVendorType linuxvendortype.Variant `json:"LinuxVendorType,omitempty"` // eg. ubuntu, centos
	Version         strtype.Variant         `json:"Version,omitempty"`         // eg. "7"
	Release         strtype.Variant         `json:"Release,omitempty"`         // eg. "7.2.1511"
	Architecture    osarchs.Architecture    `json:"Architecture,omitempty"`    // eg. "amd64"
	WindowsDetail   *WindowsSystemDetail    `json:"WindowsDetail,omitempty"`
	IsLinux         bool                    `json:"IsLinux,omitempty"`
	IsMacOs         bool                    `json:"IsMacOs,omitempty"`
	IsDocker        bool                    `json:"IsDocker,omitempty"` // TODO VM detect
	Group           ostype.Group
	// contains filtered or unexported fields
}

OperatingSystemDetail

References: - Sample from other packages : https://t.ly/Au3Q - Enum all os detect examples : https://gitlab.com/evatix-go/enum/-/issues/4

func GetCurrentOsDetail added in v0.1.3

func GetCurrentOsDetail() (*OperatingSystemDetail, error)

func (OperatingSystemDetail) AllSysTypes added in v0.1.3

func (it OperatingSystemDetail) AllSysTypes() []Variant

func (OperatingSystemDetail) AllSysTypesMap added in v0.1.3

func (it OperatingSystemDetail) AllSysTypesMap() map[Variant]bool

func (OperatingSystemDetail) Deserialize added in v0.1.3

func (it OperatingSystemDetail) Deserialize(toPtr interface{}) error

func (*OperatingSystemDetail) HasAnyItem added in v0.1.3

func (it *OperatingSystemDetail) HasAnyItem() bool

func (*OperatingSystemDetail) HasWindowsDetail added in v0.1.3

func (it *OperatingSystemDetail) HasWindowsDetail() bool

func (*OperatingSystemDetail) HasWindowsDetails added in v0.1.3

func (it *OperatingSystemDetail) HasWindowsDetails() bool

func (OperatingSystemDetail) Is32BitArch added in v0.1.3

func (it OperatingSystemDetail) Is32BitArch() bool

func (OperatingSystemDetail) Is64BitArch added in v0.1.3

func (it OperatingSystemDetail) Is64BitArch() bool

func (OperatingSystemDetail) IsAndroid added in v0.1.3

func (it OperatingSystemDetail) IsAndroid() bool

func (OperatingSystemDetail) IsAnyOfTypes added in v0.1.3

func (it OperatingSystemDetail) IsAnyOfTypes(
	mixTypes ...Variant,
) bool

func (OperatingSystemDetail) IsArch added in v0.1.3

func (OperatingSystemDetail) IsCentOsAtLeast added in v0.1.3

func (it OperatingSystemDetail) IsCentOsAtLeast(
	majorVersion int,
) bool

func (OperatingSystemDetail) IsCentos added in v0.1.3

func (it OperatingSystemDetail) IsCentos() bool

func (OperatingSystemDetail) IsDebianAtLeast added in v0.1.3

func (it OperatingSystemDetail) IsDebianAtLeast(
	majorVersion int,
) bool

func (*OperatingSystemDetail) IsEmpty added in v0.1.3

func (it *OperatingSystemDetail) IsEmpty() bool

func (*OperatingSystemDetail) IsEmptyWindowsDetail added in v0.1.3

func (it *OperatingSystemDetail) IsEmptyWindowsDetail() bool

func (*OperatingSystemDetail) IsInvalid added in v0.1.3

func (it *OperatingSystemDetail) IsInvalid() bool

func (OperatingSystemDetail) IsMacOsAtLeast added in v0.1.3

func (it OperatingSystemDetail) IsMacOsAtLeast(
	majorVersion int,
) bool

func (OperatingSystemDetail) IsMajorVersionAtLeast added in v0.1.3

func (it OperatingSystemDetail) IsMajorVersionAtLeast(
	major int,
) bool

func (OperatingSystemDetail) IsName added in v0.1.3

func (it OperatingSystemDetail) IsName(name string) bool

func (OperatingSystemDetail) IsNameContains added in v0.1.3

func (it OperatingSystemDetail) IsNameContains(name string) bool

func (OperatingSystemDetail) IsNameEndsWith added in v0.1.3

func (it OperatingSystemDetail) IsNameEndsWith(name string) bool

func (OperatingSystemDetail) IsNameStartsWith added in v0.1.3

func (it OperatingSystemDetail) IsNameStartsWith(name string) bool

func (*OperatingSystemDetail) IsNull added in v0.1.3

func (it *OperatingSystemDetail) IsNull() bool

func (OperatingSystemDetail) IsType added in v0.1.3

func (it OperatingSystemDetail) IsType(mixType Variant) bool

func (OperatingSystemDetail) IsTypePlusMajorAtLeast added in v0.1.3

func (it OperatingSystemDetail) IsTypePlusMajorAtLeast(
	mixType Variant,
	majorVersion int,
) bool

func (OperatingSystemDetail) IsTypePlusRunningInDocker added in v0.1.3

func (it OperatingSystemDetail) IsTypePlusRunningInDocker(
	mixType Variant,
) bool

func (OperatingSystemDetail) IsUbuntu added in v0.1.3

func (it OperatingSystemDetail) IsUbuntu() bool

func (OperatingSystemDetail) IsUbuntuAtLeast added in v0.1.3

func (it OperatingSystemDetail) IsUbuntuAtLeast(
	majorVersion int,
) bool

func (OperatingSystemDetail) IsUnix added in v0.1.3

func (it OperatingSystemDetail) IsUnix() bool

func (*OperatingSystemDetail) IsValid added in v0.1.3

func (it *OperatingSystemDetail) IsValid() bool

func (OperatingSystemDetail) IsVersion added in v0.1.3

func (it OperatingSystemDetail) IsVersion(
	versionCompare string,
) bool

func (OperatingSystemDetail) IsVersionAtLeast added in v0.1.3

func (it OperatingSystemDetail) IsVersionAtLeast(
	versionCompare string,
) bool

func (OperatingSystemDetail) IsWindows added in v0.1.3

func (it OperatingSystemDetail) IsWindows() bool

func (OperatingSystemDetail) IsWindowsAtLeast added in v0.1.3

func (it OperatingSystemDetail) IsWindowsAtLeast(
	majorVersion int,
) bool

func (OperatingSystemDetail) Json added in v0.1.3

func (OperatingSystemDetail) JsonPtr added in v0.1.3

func (it OperatingSystemDetail) JsonPtr() *corejson.Result

func (OperatingSystemDetail) PrettyJsonString added in v0.1.3

func (it OperatingSystemDetail) PrettyJsonString() string

func (*OperatingSystemDetail) ReleaseVersion added in v0.1.3

func (it *OperatingSystemDetail) ReleaseVersion() *coreversion.Version

func (OperatingSystemDetail) Serialize added in v0.1.3

func (it OperatingSystemDetail) Serialize() ([]byte, error)

func (OperatingSystemDetail) SerializeMust added in v0.1.3

func (it OperatingSystemDetail) SerializeMust() []byte

type OsDetailWithErr added in v0.1.3

type OsDetailWithErr struct {
	OperatingSystemDetail *OperatingSystemDetail
	Error                 string
}

func (OsDetailWithErr) AsJsonContractsBinder added in v0.1.3

func (it OsDetailWithErr) AsJsonContractsBinder() corejson.JsonContractsBinder

func (*OsDetailWithErr) Json added in v0.1.3

func (it *OsDetailWithErr) Json() corejson.Result

func (*OsDetailWithErr) JsonParseSelfInject added in v0.1.3

func (it *OsDetailWithErr) JsonParseSelfInject(jsonResult *corejson.Result) error

func (*OsDetailWithErr) JsonPtr added in v0.1.3

func (it *OsDetailWithErr) JsonPtr() *corejson.Result

func (*OsDetailWithErr) PrettyJsonString added in v0.1.3

func (it *OsDetailWithErr) PrettyJsonString() string

func (*OsDetailWithErr) String added in v0.1.3

func (it *OsDetailWithErr) String() string

type Variant

type Variant byte
const (
	Invalid Variant = iota
	AnyOs           // refers to Default, or All Os
	Windows
	Unix
	Linux
	MacOs
	Ubuntu
	Debian
	ArchLinux
	FreeBsd
	Centos
	RedHatEnterpriseLinux
	Docker
	Android
)

func CurrentOsMixType added in v0.1.3

func CurrentOsMixType() Variant

func CurrentOsMixTypes added in v0.1.3

func CurrentOsMixTypes() []Variant

func Max

func Max() Variant

func Min

func Min() Variant

func New

func New(name string) (Variant, error)

New

Creates string to the type Variant

func NewMust

func NewMust(name string) Variant

NewMust

Creates string to the type Variant

func (Variant) AllNameValues

func (it Variant) AllNameValues() []string

func (Variant) AllSysMatchingTypes added in v0.1.3

func (it Variant) AllSysMatchingTypes() []Variant

func (Variant) AllSysMatchingTypesMap added in v0.1.3

func (it Variant) AllSysMatchingTypesMap() map[Variant]bool

func (Variant) AsBasicByteEnumContractsBinder

func (it Variant) AsBasicByteEnumContractsBinder() enuminf.BasicByteEnumContractsBinder

func (Variant) AsBasicEnumContractsBinder

func (it Variant) AsBasicEnumContractsBinder() enuminf.BasicEnumContractsBinder

func (*Variant) AsJsonContractsBinder

func (it *Variant) AsJsonContractsBinder() corejson.JsonContractsBinder

func (*Variant) AsJsonMarshaller

func (it *Variant) AsJsonMarshaller() corejson.JsonMarshaller

func (*Variant) AsJsoner

func (it *Variant) AsJsoner() corejson.Jsoner

func (Variant) DefaultCmdProcessName added in v0.1.2

func (it Variant) DefaultCmdProcessName() string

func (Variant) EnumType

func (it Variant) EnumType() enuminf.EnumTyper

func (Variant) Format

func (it Variant) Format(format string) (compiled string)

func (Variant) Index

func (it Variant) Index() int

func (Variant) IntegerEnumRanges

func (it Variant) IntegerEnumRanges() []int

func (Variant) IsAllLogically added in v0.2.7

func (it Variant) IsAllLogically() bool

func (Variant) IsAllOs added in v0.2.7

func (it Variant) IsAllOs() bool

func (Variant) IsAndroid

func (it Variant) IsAndroid() bool

func (Variant) IsAnyNamesOf

func (it Variant) IsAnyNamesOf(names ...string) bool

func (Variant) IsAnyOf

func (it Variant) IsAnyOf(anyOfItems ...Variant) bool

func (Variant) IsAnyOs added in v0.2.7

func (it Variant) IsAnyOs() bool

func (Variant) IsAnyOsLogically added in v0.2.7

func (it Variant) IsAnyOsLogically() bool

func (Variant) IsAnyValuesEqual

func (it Variant) IsAnyValuesEqual(anyByteValues ...byte) bool

func (Variant) IsArchLinux added in v0.3.6

func (it Variant) IsArchLinux() bool

func (Variant) IsByteValueEqual

func (it Variant) IsByteValueEqual(value byte) bool

func (Variant) IsCentos

func (it Variant) IsCentos() bool

func (Variant) IsCurrentOs added in v0.1.3

func (it Variant) IsCurrentOs() bool

func (Variant) IsDebian added in v0.3.6

func (it Variant) IsDebian() bool

func (Variant) IsDocker

func (it Variant) IsDocker() bool

func (Variant) IsInvalid

func (it Variant) IsInvalid() bool

func (Variant) IsLinux

func (it Variant) IsLinux() bool

func (Variant) IsMacOs

func (it Variant) IsMacOs() bool

func (Variant) IsMajorAtLeast added in v0.1.3

func (it Variant) IsMajorAtLeast(majorVersion int) bool

func (Variant) IsNameEqual

func (it Variant) IsNameEqual(name string) bool

func (Variant) IsNameOf

func (it Variant) IsNameOf(anyNames ...string) bool

func (Variant) IsRedHatEnterpriseLinux added in v0.1.3

func (it Variant) IsRedHatEnterpriseLinux() bool

func (Variant) IsUbuntu

func (it Variant) IsUbuntu() bool

func (Variant) IsUninitialized

func (it Variant) IsUninitialized() bool

func (Variant) IsUnix

func (it Variant) IsUnix() bool

func (Variant) IsUnixLogically

func (it Variant) IsUnixLogically() bool

func (Variant) IsValid

func (it Variant) IsValid() bool

func (Variant) IsValueEqual

func (it Variant) IsValueEqual(value byte) bool

func (Variant) IsWindows

func (it Variant) IsWindows() bool

func (Variant) Json

func (it Variant) Json() corejson.Result

func (*Variant) JsonParseSelfInject

func (it *Variant) JsonParseSelfInject(jsonResult *corejson.Result) error

func (Variant) JsonPtr

func (it Variant) JsonPtr() *corejson.Result

func (Variant) LinuxVendorType added in v0.1.3

func (it Variant) LinuxVendorType() linuxvendortype.Variant

func (Variant) MarshalJSON

func (it Variant) MarshalJSON() ([]byte, error)

func (Variant) MaxByte

func (it Variant) MaxByte() byte

func (Variant) MaxInt

func (it Variant) MaxInt() int

func (Variant) MaxValueString

func (it Variant) MaxValueString() string

func (Variant) MinByte

func (it Variant) MinByte() byte

func (Variant) MinInt

func (it Variant) MinInt() int

func (Variant) MinMaxAny added in v0.1.3

func (it Variant) MinMaxAny() (min, max interface{})

func (Variant) MinValueString

func (it Variant) MinValueString() string

func (Variant) Name

func (it Variant) Name() string

func (Variant) NameLower

func (it Variant) NameLower() string

func (Variant) NameValue

func (it Variant) NameValue() string

func (Variant) OnlySupportedErr

func (it Variant) OnlySupportedErr(names ...string) error

func (Variant) OnlySupportedMsgErr

func (it Variant) OnlySupportedMsgErr(message string, names ...string) error

func (Variant) OsDetail added in v0.2.7

func (it Variant) OsDetail() *OperatingSystemDetail

func (Variant) OsDetailWithError added in v0.2.7

func (it Variant) OsDetailWithError() (*OperatingSystemDetail, error)

func (Variant) RangeNamesCsv

func (it Variant) RangeNamesCsv() string

func (Variant) RangesByte

func (it Variant) RangesByte() []byte

func (Variant) RangesDynamicMap

func (it Variant) RangesDynamicMap() map[string]interface{}

func (Variant) String

func (it Variant) String() string

func (Variant) ToNumberString

func (it Variant) ToNumberString() string

func (Variant) ToPtr

func (it Variant) ToPtr() *Variant

func (*Variant) ToSimple

func (it *Variant) ToSimple() Variant

func (Variant) TypeName

func (it Variant) TypeName() string

func (*Variant) UnmarshalJSON

func (it *Variant) UnmarshalJSON(data []byte) error

func (Variant) UnmarshallEnumToValue

func (it Variant) UnmarshallEnumToValue(
	jsonUnmarshallingValue []byte,
) (byte, error)

func (Variant) Value

func (it Variant) Value() byte

func (Variant) ValueByte

func (it Variant) ValueByte() byte

func (Variant) ValueInt

func (it Variant) ValueInt() int

func (Variant) ValueInt16

func (it Variant) ValueInt16() int16

func (Variant) ValueInt32

func (it Variant) ValueInt32() int32

func (Variant) ValueInt8

func (it Variant) ValueInt8() int8

func (Variant) ValueString

func (it Variant) ValueString() string

func (Variant) ValueUInt16

func (it Variant) ValueUInt16() uint16

type WindowsSystemDetail added in v0.1.3

type WindowsSystemDetail struct {
	WindowsVersion     inttype.Variant     // eg. 8, 10, 11
	ServerVersion      inttype.Variant     // eg. 2016, 2019
	CurrentVersion     coreversion.Version // eg. 6.3 https://t.ly/XLFC
	CompiledVersion    coreversion.Version
	ReleaseId          inttype.Variant
	CurrentBuildId     inttype.Variant
	BuildBranch        strtype.Variant
	InstallType        strtype.Variant
	SystemRoot         strtype.Variant
	Edition            strtype.Variant // example: "ServerStandard", "Professional", "Enterprise", "Workstation"
	CompositionEdition strtype.Variant // eg. "Enterprise" - For Windows 10, "ServerStandard" -- Windows Server
	IsServer           bool            // refers to Windows Server
	IsClient           bool            // refers to Windows 10
	CompiledError      error
}

func (*WindowsSystemDetail) IsDefined added in v0.1.3

func (it *WindowsSystemDetail) IsDefined() bool

func (*WindowsSystemDetail) IsDefinedPlus added in v0.1.3

func (it *WindowsSystemDetail) IsDefinedPlus(isCondition bool) bool

func (*WindowsSystemDetail) IsNull added in v0.1.3

func (it *WindowsSystemDetail) IsNull() bool

func (*WindowsSystemDetail) IsNullOr added in v0.1.3

func (it *WindowsSystemDetail) IsNullOr(isCondition bool) bool

func (WindowsSystemDetail) IsWindows10 added in v0.1.3

func (it WindowsSystemDetail) IsWindows10() bool

func (WindowsSystemDetail) IsWindows11 added in v0.1.3

func (it WindowsSystemDetail) IsWindows11() bool

IsWindows11

https://t.ly/Jsr1,
https://prnt.sc/wAZ5uQScNqk_

func (WindowsSystemDetail) IsWindows7 added in v0.1.3

func (it WindowsSystemDetail) IsWindows7() bool

func (WindowsSystemDetail) IsWindows8 added in v0.1.3

func (it WindowsSystemDetail) IsWindows8() bool

func (WindowsSystemDetail) IsWindowsEqual added in v0.1.3

func (it WindowsSystemDetail) IsWindowsEqual(number int) bool

func (WindowsSystemDetail) IsWindowsGreaterEqual added in v0.1.3

func (it WindowsSystemDetail) IsWindowsGreaterEqual(number int) bool

func (*WindowsSystemDetail) IsWindowsServerEqual added in v0.1.3

func (it *WindowsSystemDetail) IsWindowsServerEqual(number int) bool

func (*WindowsSystemDetail) IsWindowsServerGreaterEqual added in v0.1.3

func (it *WindowsSystemDetail) IsWindowsServerGreaterEqual(number int) bool

func (WindowsSystemDetail) IsWindowsSever added in v0.1.3

func (it WindowsSystemDetail) IsWindowsSever() bool

func (WindowsSystemDetail) IsWindowsSever2016 added in v0.1.3

func (it WindowsSystemDetail) IsWindowsSever2016() bool

func (WindowsSystemDetail) IsWindowsSever2019 added in v0.1.3

func (it WindowsSystemDetail) IsWindowsSever2019() bool

func (WindowsSystemDetail) IsWindowsSeverGreaterEqual2016 added in v0.1.3

func (it WindowsSystemDetail) IsWindowsSeverGreaterEqual2016() bool

func (WindowsSystemDetail) IsWindowsSeverGreaterEqual2019 added in v0.1.3

func (it WindowsSystemDetail) IsWindowsSeverGreaterEqual2019() bool

func (*WindowsSystemDetail) WinVer added in v0.1.3

func (it *WindowsSystemDetail) WinVer() inttype.Variant

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL