github.com/aldelo/common@v1.5.1/wrapper/redis/redisbitop/redisbitop_enumer.go (about)

     1  // Code Generated By gen-enumer For "Enum Type: RedisBitop" - DO NOT EDIT;
     2  
     3  /*
     4   * Copyright 2020-2023 Aldelo, LP
     5   *
     6   * Licensed under the Apache License, Version 2.0 (the "License");
     7   * you may not use this file except in compliance with the License.
     8   * You may obtain a copy of the License at
     9   *
    10   *     http://www.apache.org/licenses/LICENSE-2.0
    11   *
    12   * Unless required by applicable law or agreed to in writing, software
    13   * distributed under the License is distributed on an "AS IS" BASIS,
    14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    15   * See the License for the specific language governing permissions and
    16   * limitations under the License.
    17   */
    18  
    19  package redisbitop
    20  
    21  import (
    22  	"fmt"
    23  	"strconv"
    24  )
    25  
    26  const (
    27  	_RedisBitopKey_0 = "UNKNOWN"
    28  	_RedisBitopKey_1 = "And"
    29  	_RedisBitopKey_2 = "Or"
    30  	_RedisBitopKey_3 = "XOr"
    31  	_RedisBitopKey_4 = "NOT"
    32  )
    33  
    34  const (
    35  	_RedisBitopCaption_0 = "UNKNOWN"
    36  	_RedisBitopCaption_1 = "And"
    37  	_RedisBitopCaption_2 = "Or"
    38  	_RedisBitopCaption_3 = "XOr"
    39  	_RedisBitopCaption_4 = "NOT"
    40  )
    41  
    42  const (
    43  	_RedisBitopDescription_0 = "UNKNOWN"
    44  	_RedisBitopDescription_1 = "And"
    45  	_RedisBitopDescription_2 = "Or"
    46  	_RedisBitopDescription_3 = "XOr"
    47  	_RedisBitopDescription_4 = "NOT"
    48  )
    49  
    50  // enum names constants
    51  const (
    52  	_RedisBitopName_0 = "UNKNOWN"
    53  	_RedisBitopName_1 = "And"
    54  	_RedisBitopName_2 = "Or"
    55  	_RedisBitopName_3 = "XOr"
    56  	_RedisBitopName_4 = "NOT"
    57  )
    58  
    59  // var declares of enum indexes
    60  var (
    61  	_RedisBitopIndex_0 = [...]uint8{0, 7}
    62  	_RedisBitopIndex_1 = [...]uint8{0, 3}
    63  	_RedisBitopIndex_2 = [...]uint8{0, 2}
    64  	_RedisBitopIndex_3 = [...]uint8{0, 3}
    65  	_RedisBitopIndex_4 = [...]uint8{0, 3}
    66  )
    67  
    68  func (i RedisBitop) String() string {
    69  	switch {
    70  	case i == UNKNOWN:
    71  		return _RedisBitopName_0
    72  	case i == And:
    73  		return _RedisBitopName_1
    74  	case i == Or:
    75  		return _RedisBitopName_2
    76  	case i == XOr:
    77  		return _RedisBitopName_3
    78  	case i == NOT:
    79  		return _RedisBitopName_4
    80  	default:
    81  		return ""
    82  	}
    83  }
    84  
    85  var _RedisBitopValues = []RedisBitop{
    86  	0, // UNKNOWN
    87  	1, // And
    88  	2, // Or
    89  	3, // XOr
    90  	4, // NOT
    91  }
    92  
    93  var _RedisBitopNameToValueMap = map[string]RedisBitop{
    94  	_RedisBitopName_0[0:7]: 0, // UNKNOWN
    95  	_RedisBitopName_1[0:3]: 1, // And
    96  	_RedisBitopName_2[0:2]: 2, // Or
    97  	_RedisBitopName_3[0:3]: 3, // XOr
    98  	_RedisBitopName_4[0:3]: 4, // NOT
    99  }
   100  
   101  var _RedisBitopValueToKeyMap = map[RedisBitop]string{
   102  	0: _RedisBitopKey_0, // UNKNOWN
   103  	1: _RedisBitopKey_1, // And
   104  	2: _RedisBitopKey_2, // Or
   105  	3: _RedisBitopKey_3, // XOr
   106  	4: _RedisBitopKey_4, // NOT
   107  }
   108  
   109  var _RedisBitopValueToCaptionMap = map[RedisBitop]string{
   110  	0: _RedisBitopCaption_0, // UNKNOWN
   111  	1: _RedisBitopCaption_1, // And
   112  	2: _RedisBitopCaption_2, // Or
   113  	3: _RedisBitopCaption_3, // XOr
   114  	4: _RedisBitopCaption_4, // NOT
   115  }
   116  
   117  var _RedisBitopValueToDescriptionMap = map[RedisBitop]string{
   118  	0: _RedisBitopDescription_0, // UNKNOWN
   119  	1: _RedisBitopDescription_1, // And
   120  	2: _RedisBitopDescription_2, // Or
   121  	3: _RedisBitopDescription_3, // XOr
   122  	4: _RedisBitopDescription_4, // NOT
   123  }
   124  
   125  // Valid returns 'true' if the value is listed in the RedisBitop enum map definition, 'false' otherwise
   126  func (i RedisBitop) Valid() bool {
   127  	for _, v := range _RedisBitopValues {
   128  		if i == v {
   129  			return true
   130  		}
   131  	}
   132  
   133  	return false
   134  }
   135  
   136  // ParseByName retrieves a RedisBitop enum value from the enum string name,
   137  // throws an error if the param is not part of the enum
   138  func (i RedisBitop) ParseByName(s string) (RedisBitop, error) {
   139  	if val, ok := _RedisBitopNameToValueMap[s]; ok {
   140  		// parse ok
   141  		return val, nil
   142  	}
   143  
   144  	// error
   145  	return -1, fmt.Errorf("Enum Name of %s Not Expected In RedisBitop Values List", s)
   146  }
   147  
   148  // ParseByKey retrieves a RedisBitop enum value from the enum string key,
   149  // throws an error if the param is not part of the enum
   150  func (i RedisBitop) ParseByKey(s string) (RedisBitop, error) {
   151  	for k, v := range _RedisBitopValueToKeyMap {
   152  		if v == s {
   153  			// parse ok
   154  			return k, nil
   155  		}
   156  	}
   157  
   158  	// error
   159  	return -1, fmt.Errorf("Enum Key of %s Not Expected In RedisBitop Keys List", s)
   160  }
   161  
   162  // Key retrieves a RedisBitop enum string key
   163  func (i RedisBitop) Key() string {
   164  	if val, ok := _RedisBitopValueToKeyMap[i]; ok {
   165  		// found
   166  		return val
   167  	} else {
   168  		// not found
   169  		return ""
   170  	}
   171  }
   172  
   173  // Caption retrieves a RedisBitop enum string caption
   174  func (i RedisBitop) Caption() string {
   175  	if val, ok := _RedisBitopValueToCaptionMap[i]; ok {
   176  		// found
   177  		return val
   178  	} else {
   179  		// not found
   180  		return ""
   181  	}
   182  }
   183  
   184  // Description retrieves a RedisBitop enum string description
   185  func (i RedisBitop) Description() string {
   186  	if val, ok := _RedisBitopValueToDescriptionMap[i]; ok {
   187  		// found
   188  		return val
   189  	} else {
   190  		// not found
   191  		return ""
   192  	}
   193  }
   194  
   195  // IntValue gets the intrinsic enum integer value
   196  func (i RedisBitop) IntValue() int {
   197  	return int(i)
   198  }
   199  
   200  // IntString gets the intrinsic enum integer value represented in string format
   201  func (i RedisBitop) IntString() string {
   202  	return strconv.Itoa(int(i))
   203  }
   204  
   205  // ValueSlice returns all values of the enum RedisBitop in a slice
   206  func (i RedisBitop) ValueSlice() []RedisBitop {
   207  	return _RedisBitopValues
   208  }
   209  
   210  // NameMap returns all names of the enum RedisBitop in a K:name,V:RedisBitop map
   211  func (i RedisBitop) NameMap() map[string]RedisBitop {
   212  	return _RedisBitopNameToValueMap
   213  }
   214  
   215  // KeyMap returns all keys of the enum RedisBitop in a K:RedisBitop,V:key map
   216  func (i RedisBitop) KeyMap() map[RedisBitop]string {
   217  	return _RedisBitopValueToKeyMap
   218  }
   219  
   220  // CaptionMap returns all captions of the enum RedisBitop in a K:RedisBitop,V:caption map
   221  func (i RedisBitop) CaptionMap() map[RedisBitop]string {
   222  	return _RedisBitopValueToCaptionMap
   223  }
   224  
   225  // DescriptionMap returns all descriptions of the enum RedisBitop in a K:RedisBitop,V:description map
   226  func (i RedisBitop) DescriptionMap() map[RedisBitop]string {
   227  	return _RedisBitopValueToDescriptionMap
   228  }