github.com/urso/go-structform@v0.0.2/gotype/fold_refl_sel.generated.go (about)

     1  // This file has been generated from 'fold_refl_sel.yml', do not edit
     2  package gotype
     3  
     4  import "reflect"
     5  
     6  var _reflPrimitivesMapping = map[reflect.Type]reFoldFn{
     7  
     8  	tBool: reFoldBool,
     9  	reflect.SliceOf(tBool):        reFoldArrBool,
    10  	reflect.MapOf(tString, tBool): reFoldMapBool,
    11  
    12  	tString:                         reFoldString,
    13  	reflect.SliceOf(tString):        reFoldArrString,
    14  	reflect.MapOf(tString, tString): reFoldMapString,
    15  
    16  	tUint: reFoldUint,
    17  	reflect.SliceOf(tUint):        reFoldArrUint,
    18  	reflect.MapOf(tString, tUint): reFoldMapUint,
    19  
    20  	tUint8:                         reFoldUint8,
    21  	reflect.SliceOf(tUint8):        reFoldArrUint8,
    22  	reflect.MapOf(tString, tUint8): reFoldMapUint8,
    23  
    24  	tUint16:                         reFoldUint16,
    25  	reflect.SliceOf(tUint16):        reFoldArrUint16,
    26  	reflect.MapOf(tString, tUint16): reFoldMapUint16,
    27  
    28  	tUint32:                         reFoldUint32,
    29  	reflect.SliceOf(tUint32):        reFoldArrUint32,
    30  	reflect.MapOf(tString, tUint32): reFoldMapUint32,
    31  
    32  	tUint64:                         reFoldUint64,
    33  	reflect.SliceOf(tUint64):        reFoldArrUint64,
    34  	reflect.MapOf(tString, tUint64): reFoldMapUint64,
    35  
    36  	tInt: reFoldInt,
    37  	reflect.SliceOf(tInt):        reFoldArrInt,
    38  	reflect.MapOf(tString, tInt): reFoldMapInt,
    39  
    40  	tInt8: reFoldInt8,
    41  	reflect.SliceOf(tInt8):        reFoldArrInt8,
    42  	reflect.MapOf(tString, tInt8): reFoldMapInt8,
    43  
    44  	tInt16:                         reFoldInt16,
    45  	reflect.SliceOf(tInt16):        reFoldArrInt16,
    46  	reflect.MapOf(tString, tInt16): reFoldMapInt16,
    47  
    48  	tInt32:                         reFoldInt32,
    49  	reflect.SliceOf(tInt32):        reFoldArrInt32,
    50  	reflect.MapOf(tString, tInt32): reFoldMapInt32,
    51  
    52  	tInt64:                         reFoldInt64,
    53  	reflect.SliceOf(tInt64):        reFoldArrInt64,
    54  	reflect.MapOf(tString, tInt64): reFoldMapInt64,
    55  
    56  	tFloat32:                         reFoldFloat32,
    57  	reflect.SliceOf(tFloat32):        reFoldArrFloat32,
    58  	reflect.MapOf(tString, tFloat32): reFoldMapFloat32,
    59  
    60  	tFloat64:                         reFoldFloat64,
    61  	reflect.SliceOf(tFloat64):        reFoldArrFloat64,
    62  	reflect.MapOf(tString, tFloat64): reFoldMapFloat64,
    63  }
    64  
    65  func getReflectFoldPrimitive(t reflect.Type) reFoldFn {
    66  	return _reflPrimitivesMapping[t]
    67  }
    68  
    69  func getReflectFoldPrimitiveKind(t reflect.Type) (reFoldFn, error) {
    70  	switch t.Kind() {
    71  
    72  	case reflect.Bool:
    73  		return reFoldBool, nil
    74  
    75  	case reflect.String:
    76  		return reFoldString, nil
    77  
    78  	case reflect.Uint:
    79  		return reFoldUint, nil
    80  
    81  	case reflect.Uint8:
    82  		return reFoldUint8, nil
    83  
    84  	case reflect.Uint16:
    85  		return reFoldUint16, nil
    86  
    87  	case reflect.Uint32:
    88  		return reFoldUint32, nil
    89  
    90  	case reflect.Uint64:
    91  		return reFoldUint64, nil
    92  
    93  	case reflect.Int:
    94  		return reFoldInt, nil
    95  
    96  	case reflect.Int8:
    97  		return reFoldInt8, nil
    98  
    99  	case reflect.Int16:
   100  		return reFoldInt16, nil
   101  
   102  	case reflect.Int32:
   103  		return reFoldInt32, nil
   104  
   105  	case reflect.Int64:
   106  		return reFoldInt64, nil
   107  
   108  	case reflect.Float32:
   109  		return reFoldFloat32, nil
   110  
   111  	case reflect.Float64:
   112  		return reFoldFloat64, nil
   113  
   114  	default:
   115  		return nil, errUnsupported
   116  	}
   117  }