gitlab.com/evatix-go/core@v1.3.55/ostype/Group.go (about)

     1  package ostype
     2  
     3  import (
     4  	"gitlab.com/evatix-go/core/coredata/corejson"
     5  	"gitlab.com/evatix-go/core/coreinterface/enuminf"
     6  )
     7  
     8  type Group byte
     9  
    10  const (
    11  	WindowsGroup Group = iota
    12  	UnixGroup
    13  	AndroidGroup
    14  	InvalidGroup
    15  )
    16  
    17  func (it Group) AllNameValues() []string {
    18  	return basicEnumImplOsGroup.AllNameValues()
    19  }
    20  
    21  func (it Group) OnlySupportedErr(names ...string) error {
    22  	return basicEnumImplOsGroup.OnlySupportedErr(names...)
    23  }
    24  
    25  func (it Group) OnlySupportedMsgErr(message string, names ...string) error {
    26  	return basicEnumImplOsGroup.OnlySupportedMsgErr(message, names...)
    27  }
    28  
    29  func (it Group) ValueUInt16() uint16 {
    30  	return uint16(it)
    31  }
    32  
    33  func (it Group) IntegerEnumRanges() []int {
    34  	return basicEnumImplOsGroup.IntegerEnumRanges()
    35  }
    36  
    37  func (it Group) MinMaxAny() (min, max interface{}) {
    38  	return basicEnumImplOsGroup.MinMaxAny()
    39  }
    40  
    41  func (it Group) MinValueString() string {
    42  	return basicEnumImplOsGroup.MinValueString()
    43  }
    44  
    45  func (it Group) MaxValueString() string {
    46  	return basicEnumImplOsGroup.MaxValueString()
    47  }
    48  
    49  func (it Group) MaxInt() int {
    50  	return basicEnumImplOsGroup.MaxInt()
    51  }
    52  
    53  func (it Group) MinInt() int {
    54  	return basicEnumImplOsGroup.MinInt()
    55  }
    56  
    57  func (it Group) RangesDynamicMap() map[string]interface{} {
    58  	return basicEnumImplOsGroup.RangesDynamicMap()
    59  }
    60  
    61  func (it Group) IsByteValueEqual(value byte) bool {
    62  	return byte(it) == value
    63  }
    64  
    65  func (it Group) Format(format string) (compiled string) {
    66  	return basicEnumImplOsGroup.Format(format, it)
    67  }
    68  
    69  func (it Group) IsEnumEqual(enum enuminf.BasicEnumer) bool {
    70  	return it.Value() == enum.ValueByte()
    71  }
    72  
    73  func (it *Group) IsAnyEnumsEqual(enums ...enuminf.BasicEnumer) bool {
    74  	for _, enum := range enums {
    75  		if it.IsEnumEqual(enum) {
    76  			return true
    77  		}
    78  	}
    79  
    80  	return false
    81  }
    82  
    83  func (it Group) IsNameEqual(name string) bool {
    84  	return it.Name() == name
    85  }
    86  
    87  func (it Group) IsAnyNamesOf(names ...string) bool {
    88  	for _, name := range names {
    89  		if it.IsNameEqual(name) {
    90  			return true
    91  		}
    92  	}
    93  
    94  	return false
    95  }
    96  
    97  func (it Group) IsValueEqual(value byte) bool {
    98  	return it.ValueByte() == value
    99  }
   100  
   101  func (it Group) IsAnyValuesEqual(anyByteValues ...byte) bool {
   102  	for _, currentVal := range anyByteValues {
   103  		if it.IsValueEqual(currentVal) {
   104  			return true
   105  		}
   106  	}
   107  
   108  	return false
   109  }
   110  
   111  func (it Group) ValueInt() int {
   112  	return int(it)
   113  }
   114  
   115  func (it Group) ValueInt8() int8 {
   116  	return int8(it)
   117  }
   118  
   119  func (it Group) ValueInt16() int16 {
   120  	return int16(it)
   121  }
   122  
   123  func (it Group) ValueInt32() int32 {
   124  	return int32(it)
   125  }
   126  
   127  func (it Group) ValueString() string {
   128  	return it.ToNumberString()
   129  }
   130  
   131  func (it Group) Is(another Group) bool {
   132  	return it == another
   133  }
   134  
   135  func (it Group) IsWindows() bool {
   136  	return it == WindowsGroup
   137  }
   138  
   139  func (it Group) IsUnix() bool {
   140  	return it == UnixGroup
   141  }
   142  
   143  func (it Group) IsAndroid() bool {
   144  	return it == AndroidGroup
   145  }
   146  
   147  func (it Group) IsInvalidGroup() bool {
   148  	return it == InvalidGroup
   149  }
   150  
   151  func (it Group) Byte() byte {
   152  	return byte(it)
   153  }
   154  
   155  func (it Group) MarshalJSON() ([]byte, error) {
   156  	return basicEnumImplOsGroup.ToEnumJsonBytes(it.Value())
   157  }
   158  
   159  func (it *Group) UnmarshalJSON(data []byte) error {
   160  	valueByte, err := basicEnumImplOsGroup.UnmarshallToValue(
   161  		true,
   162  		data)
   163  
   164  	if err == nil {
   165  		*it = Group(valueByte)
   166  	}
   167  
   168  	return err
   169  }
   170  
   171  func (it Group) Name() string {
   172  	return basicEnumImplOsGroup.ToEnumString(it.Value())
   173  }
   174  
   175  func (it Group) NameValue() string {
   176  	return basicEnumImplOsGroup.NameWithValue(it.Value())
   177  }
   178  
   179  func (it Group) ToNumberString() string {
   180  	return basicEnumImplOsGroup.ToNumberString(it.Value())
   181  }
   182  
   183  func (it Group) RangeNamesCsv() string {
   184  	return basicEnumImplOsGroup.RangeNamesCsv()
   185  }
   186  
   187  func (it Group) TypeName() string {
   188  	return basicEnumImplOsGroup.TypeName()
   189  }
   190  
   191  func (it Group) UnmarshallEnumToValue(jsonUnmarshallingValue []byte) (byte, error) {
   192  	return basicEnumImplOsGroup.UnmarshallToValue(true, jsonUnmarshallingValue)
   193  }
   194  
   195  func (it Group) MaxByte() byte {
   196  	return basicEnumImplOsGroup.Max()
   197  }
   198  
   199  func (it Group) MinByte() byte {
   200  	return basicEnumImplOsGroup.Min()
   201  }
   202  
   203  func (it Group) ValueByte() byte {
   204  	return byte(it)
   205  }
   206  
   207  func (it Group) RangesByte() []byte {
   208  	return basicEnumImplOsGroup.Ranges()
   209  }
   210  
   211  func (it Group) Value() byte {
   212  	return byte(it)
   213  }
   214  
   215  func (it Group) String() string {
   216  	return basicEnumImplOsGroup.ToEnumString(it.Value())
   217  }
   218  
   219  func (it Group) IsValid() bool {
   220  	return it != InvalidGroup
   221  }
   222  
   223  func (it Group) IsInvalid() bool {
   224  	return it == InvalidGroup
   225  }
   226  
   227  func (it Group) EnumType() enuminf.EnumTyper {
   228  	return basicEnumImplOsGroup.EnumType()
   229  }
   230  
   231  func (it *Group) AsBasicEnumContractsBinder() enuminf.BasicEnumContractsBinder {
   232  	return it
   233  }
   234  
   235  func (it *Group) AsJsonContractsBinder() corejson.JsonMarshaller {
   236  	return it
   237  }
   238  
   239  func (it Group) AsBasicByteEnumContractsBinder() enuminf.BasicByteEnumContractsBinder {
   240  	return &it
   241  }
   242  
   243  func (it Group) ToPtr() *Group {
   244  	return &it
   245  }