gitlab.com/evatix-go/core@v1.3.55/issetter/vars.go (about)

     1  package issetter
     2  
     3  import (
     4  	"reflect"
     5  
     6  	"gitlab.com/evatix-go/core/internal/csvinternal"
     7  	"gitlab.com/evatix-go/core/simplewrap"
     8  )
     9  
    10  var (
    11  	valuesNames = []string{"Uninitialized", "True", "False", "Unset", "Set", "Wildcard"}
    12  
    13  	jsonValuesMap = map[string]Value{
    14  		simplewrap.WithDoubleQuote("0"):        Uninitialized,
    15  		simplewrap.WithDoubleQuote(""):         Uninitialized,
    16  		simplewrap.WithDoubleQuote("-"):        Uninitialized,
    17  		simplewrap.WithDoubleQuote("-1"):       Uninitialized,
    18  		simplewrap.WithDoubleQuote("1"):        True,
    19  		simplewrap.WithDoubleQuote("yes"):      True,
    20  		simplewrap.WithDoubleQuote("Yes"):      True,
    21  		simplewrap.WithDoubleQuote("true"):     True,
    22  		simplewrap.WithDoubleQuote("True"):     True,
    23  		simplewrap.WithDoubleQuote("no"):       False,
    24  		simplewrap.WithDoubleQuote("No"):       False,
    25  		simplewrap.WithDoubleQuote("Nop"):      False,
    26  		simplewrap.WithDoubleQuote("None"):     False,
    27  		simplewrap.WithDoubleQuote("false"):    False,
    28  		simplewrap.WithDoubleQuote("False"):    False,
    29  		simplewrap.WithDoubleQuote("set"):      Set,
    30  		simplewrap.WithDoubleQuote("Set"):      Set,
    31  		simplewrap.WithDoubleQuote("Unset"):    Unset,
    32  		simplewrap.WithDoubleQuote("unset"):    Unset,
    33  		simplewrap.WithDoubleQuote("*"):        Wildcard,
    34  		simplewrap.WithDoubleQuote("%"):        Wildcard,
    35  		simplewrap.WithDoubleQuote("Wildcard"): Wildcard,
    36  		simplewrap.WithDoubleQuote("WildCard"): Wildcard,
    37  		simplewrap.WithDoubleQuote("wildcard"): Wildcard, // all small
    38  		"0":                                    Uninitialized,
    39  		"":                                     Uninitialized,
    40  		"-":                                    Uninitialized,
    41  		"true":                                 True,
    42  		"True":                                 True,
    43  		"yes":                                  True,
    44  		"Yes":                                  True,
    45  		"y":                                    True,
    46  		"Y":                                    True,
    47  		"1":                                    True,
    48  		"false":                                False,
    49  		"False":                                False,
    50  		"no":                                   False,
    51  		"No":                                   False,
    52  		"n":                                    False,
    53  		"N":                                    False,
    54  		"2":                                    True,
    55  		"*":                                    Wildcard,
    56  		"Wildcard":                             Wildcard,
    57  		"wildcard":                             Wildcard,
    58  		"%":                                    Wildcard,
    59  		"set":                                  Set,
    60  		"Set":                                  Set,
    61  		"Unset":                                Unset,
    62  		"unset":                                Unset,
    63  	}
    64  
    65  	valuesToJsonBytesMap = map[Value][]byte{
    66  		Uninitialized: jsonBytes("Uninitialized"),
    67  		True:          jsonBytes("True"),
    68  		False:         jsonBytes("False"),
    69  		Unset:         jsonBytes("Unset"),
    70  		Set:           jsonBytes("Set"),
    71  		Wildcard:      jsonBytes("Wildcard"),
    72  	}
    73  
    74  	undefinedMap = map[Value]bool{
    75  		Uninitialized: true,
    76  		Wildcard:      true,
    77  	}
    78  
    79  	falseMap = map[Value]bool{
    80  		False: true,
    81  		Unset: true,
    82  	}
    83  
    84  	trueMap = map[Value]bool{
    85  		True: true,
    86  		Set:  true,
    87  	}
    88  
    89  	valuesToNameMap = map[Value]string{
    90  		Uninitialized: "Uninitialized",
    91  		True:          "True",
    92  		False:         "False",
    93  		Unset:         "Unset",
    94  		Set:           "Set",
    95  		Wildcard:      "Wildcard",
    96  	}
    97  
    98  	lowerCaseYesNoNames = map[Value]string{
    99  		Uninitialized: "-",
   100  		True:          "yes",
   101  		False:         "no",
   102  		Set:           "yes",
   103  		Unset:         "no",
   104  		Wildcard:      "*",
   105  	}
   106  
   107  	yesNoNames = map[Value]string{
   108  		Uninitialized: "-",
   109  		True:          "Yes",
   110  		False:         "No",
   111  		Set:           "Yes",
   112  		Unset:         "No",
   113  		Wildcard:      "*",
   114  	}
   115  
   116  	lowerCaseOnOffNames = map[Value]string{
   117  		Uninitialized: "-",
   118  		True:          "on",
   119  		False:         "off",
   120  		Set:           "on",
   121  		Unset:         "off",
   122  		Wildcard:      "*",
   123  	}
   124  
   125  	onOffNames = map[Value]string{
   126  		Uninitialized: "-",
   127  		True:          "On",
   128  		False:         "Off",
   129  		Set:           "On",
   130  		Unset:         "Off",
   131  		Wildcard:      "*",
   132  	}
   133  
   134  	trueFalseNames = map[Value]string{
   135  		Uninitialized: "-",
   136  		True:          "True",
   137  		False:         "False",
   138  		Set:           "True",
   139  		Unset:         "False",
   140  		Wildcard:      "*",
   141  	}
   142  
   143  	trueFalseLowerNames = map[Value]string{
   144  		Uninitialized: "-",
   145  		True:          "true",
   146  		False:         "false",
   147  		Set:           "true",
   148  		Unset:         "false",
   149  		Wildcard:      "*",
   150  	}
   151  
   152  	setUnsetLowerNames = map[Value]string{
   153  		Uninitialized: "-",
   154  		True:          "set",
   155  		False:         "unset",
   156  		Set:           "set",
   157  		Unset:         "unset",
   158  		Wildcard:      "*",
   159  	}
   160  
   161  	convSetUnsetToTrueFalseMap = map[Value]Value{
   162  		Uninitialized: Uninitialized,
   163  		True:          True,
   164  		False:         False,
   165  		Set:           True,
   166  		Unset:         False,
   167  		Wildcard:      Wildcard,
   168  	}
   169  
   170  	convTrueFalseToSetUnsetMap = map[Value]Value{
   171  		Uninitialized: Uninitialized,
   172  		True:          Set,
   173  		False:         Unset,
   174  		Set:           Set,
   175  		Unset:         Unset,
   176  		Wildcard:      Wildcard,
   177  	}
   178  
   179  	rangesCsvString = csvinternal.RangeNamesWithValuesIndexesCsvString(
   180  		valuesNames...)
   181  
   182  	dynamicRangesMap = generateDynamicRangesMap()
   183  	integerRanges    = IntegerEnumRanges()
   184  
   185  	typeName = reflect.TypeOf(Uninitialized).String()
   186  )