github.com/aldelo/common@v1.5.1/wrapper/redis/redissetcondition/redissetcondition_enumer.go (about)

     1  // Code Generated By gen-enumer For "Enum Type: RedisSetCondition" - 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 redissetcondition
    20  
    21  import (
    22  	"fmt"
    23  	"strconv"
    24  )
    25  
    26  const (
    27  	_RedisSetConditionKey_0 = "UNKNOWN"
    28  	_RedisSetConditionKey_1 = "Normal"
    29  	_RedisSetConditionKey_2 = "SetIfExists"
    30  	_RedisSetConditionKey_3 = "SetIfNotExists"
    31  )
    32  
    33  const (
    34  	_RedisSetConditionCaption_0 = "UNKNOWN"
    35  	_RedisSetConditionCaption_1 = "Normal"
    36  	_RedisSetConditionCaption_2 = "SetIfExists"
    37  	_RedisSetConditionCaption_3 = "SetIfNotExists"
    38  )
    39  
    40  const (
    41  	_RedisSetConditionDescription_0 = "UNKNOWN"
    42  	_RedisSetConditionDescription_1 = "Normal"
    43  	_RedisSetConditionDescription_2 = "SetIfExists"
    44  	_RedisSetConditionDescription_3 = "SetIfNotExists"
    45  )
    46  
    47  // enum names constants
    48  const (
    49  	_RedisSetConditionName_0 = "UNKNOWN"
    50  	_RedisSetConditionName_1 = "Normal"
    51  	_RedisSetConditionName_2 = "SetIfExists"
    52  	_RedisSetConditionName_3 = "SetIfNotExists"
    53  )
    54  
    55  // var declares of enum indexes
    56  var (
    57  	_RedisSetConditionIndex_0 = [...]uint8{0, 7}
    58  	_RedisSetConditionIndex_1 = [...]uint8{0, 6}
    59  	_RedisSetConditionIndex_2 = [...]uint8{0, 11}
    60  	_RedisSetConditionIndex_3 = [...]uint8{0, 14}
    61  )
    62  
    63  func (i RedisSetCondition) String() string {
    64  	switch {
    65  	case i == UNKNOWN:
    66  		return _RedisSetConditionName_0
    67  	case i == Normal:
    68  		return _RedisSetConditionName_1
    69  	case i == SetIfExists:
    70  		return _RedisSetConditionName_2
    71  	case i == SetIfNotExists:
    72  		return _RedisSetConditionName_3
    73  	default:
    74  		return ""
    75  	}
    76  }
    77  
    78  var _RedisSetConditionValues = []RedisSetCondition{
    79  	0, // UNKNOWN
    80  	1, // Normal
    81  	2, // SetIfExists
    82  	3, // SetIfNotExists
    83  }
    84  
    85  var _RedisSetConditionNameToValueMap = map[string]RedisSetCondition{
    86  	_RedisSetConditionName_0[0:7]:  0, // UNKNOWN
    87  	_RedisSetConditionName_1[0:6]:  1, // Normal
    88  	_RedisSetConditionName_2[0:11]: 2, // SetIfExists
    89  	_RedisSetConditionName_3[0:14]: 3, // SetIfNotExists
    90  }
    91  
    92  var _RedisSetConditionValueToKeyMap = map[RedisSetCondition]string{
    93  	0: _RedisSetConditionKey_0, // UNKNOWN
    94  	1: _RedisSetConditionKey_1, // Normal
    95  	2: _RedisSetConditionKey_2, // SetIfExists
    96  	3: _RedisSetConditionKey_3, // SetIfNotExists
    97  }
    98  
    99  var _RedisSetConditionValueToCaptionMap = map[RedisSetCondition]string{
   100  	0: _RedisSetConditionCaption_0, // UNKNOWN
   101  	1: _RedisSetConditionCaption_1, // Normal
   102  	2: _RedisSetConditionCaption_2, // SetIfExists
   103  	3: _RedisSetConditionCaption_3, // SetIfNotExists
   104  }
   105  
   106  var _RedisSetConditionValueToDescriptionMap = map[RedisSetCondition]string{
   107  	0: _RedisSetConditionDescription_0, // UNKNOWN
   108  	1: _RedisSetConditionDescription_1, // Normal
   109  	2: _RedisSetConditionDescription_2, // SetIfExists
   110  	3: _RedisSetConditionDescription_3, // SetIfNotExists
   111  }
   112  
   113  // Valid returns 'true' if the value is listed in the RedisSetCondition enum map definition, 'false' otherwise
   114  func (i RedisSetCondition) Valid() bool {
   115  	for _, v := range _RedisSetConditionValues {
   116  		if i == v {
   117  			return true
   118  		}
   119  	}
   120  
   121  	return false
   122  }
   123  
   124  // ParseByName retrieves a RedisSetCondition enum value from the enum string name,
   125  // throws an error if the param is not part of the enum
   126  func (i RedisSetCondition) ParseByName(s string) (RedisSetCondition, error) {
   127  	if val, ok := _RedisSetConditionNameToValueMap[s]; ok {
   128  		// parse ok
   129  		return val, nil
   130  	}
   131  
   132  	// error
   133  	return -1, fmt.Errorf("Enum Name of %s Not Expected In RedisSetCondition Values List", s)
   134  }
   135  
   136  // ParseByKey retrieves a RedisSetCondition enum value from the enum string key,
   137  // throws an error if the param is not part of the enum
   138  func (i RedisSetCondition) ParseByKey(s string) (RedisSetCondition, error) {
   139  	for k, v := range _RedisSetConditionValueToKeyMap {
   140  		if v == s {
   141  			// parse ok
   142  			return k, nil
   143  		}
   144  	}
   145  
   146  	// error
   147  	return -1, fmt.Errorf("Enum Key of %s Not Expected In RedisSetCondition Keys List", s)
   148  }
   149  
   150  // Key retrieves a RedisSetCondition enum string key
   151  func (i RedisSetCondition) Key() string {
   152  	if val, ok := _RedisSetConditionValueToKeyMap[i]; ok {
   153  		// found
   154  		return val
   155  	} else {
   156  		// not found
   157  		return ""
   158  	}
   159  }
   160  
   161  // Caption retrieves a RedisSetCondition enum string caption
   162  func (i RedisSetCondition) Caption() string {
   163  	if val, ok := _RedisSetConditionValueToCaptionMap[i]; ok {
   164  		// found
   165  		return val
   166  	} else {
   167  		// not found
   168  		return ""
   169  	}
   170  }
   171  
   172  // Description retrieves a RedisSetCondition enum string description
   173  func (i RedisSetCondition) Description() string {
   174  	if val, ok := _RedisSetConditionValueToDescriptionMap[i]; ok {
   175  		// found
   176  		return val
   177  	} else {
   178  		// not found
   179  		return ""
   180  	}
   181  }
   182  
   183  // IntValue gets the intrinsic enum integer value
   184  func (i RedisSetCondition) IntValue() int {
   185  	return int(i)
   186  }
   187  
   188  // IntString gets the intrinsic enum integer value represented in string format
   189  func (i RedisSetCondition) IntString() string {
   190  	return strconv.Itoa(int(i))
   191  }
   192  
   193  // ValueSlice returns all values of the enum RedisSetCondition in a slice
   194  func (i RedisSetCondition) ValueSlice() []RedisSetCondition {
   195  	return _RedisSetConditionValues
   196  }
   197  
   198  // NameMap returns all names of the enum RedisSetCondition in a K:name,V:RedisSetCondition map
   199  func (i RedisSetCondition) NameMap() map[string]RedisSetCondition {
   200  	return _RedisSetConditionNameToValueMap
   201  }
   202  
   203  // KeyMap returns all keys of the enum RedisSetCondition in a K:RedisSetCondition,V:key map
   204  func (i RedisSetCondition) KeyMap() map[RedisSetCondition]string {
   205  	return _RedisSetConditionValueToKeyMap
   206  }
   207  
   208  // CaptionMap returns all captions of the enum RedisSetCondition in a K:RedisSetCondition,V:caption map
   209  func (i RedisSetCondition) CaptionMap() map[RedisSetCondition]string {
   210  	return _RedisSetConditionValueToCaptionMap
   211  }
   212  
   213  // DescriptionMap returns all descriptions of the enum RedisSetCondition in a K:RedisSetCondition,V:description map
   214  func (i RedisSetCondition) DescriptionMap() map[RedisSetCondition]string {
   215  	return _RedisSetConditionValueToDescriptionMap
   216  }