github.com/aldelo/common@v1.5.1/wrapper/redis/redisradiusunit/redisradiusunit_enumer.go (about)

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