github.com/dolthub/go-mysql-server@v0.18.0/sql/encodings/swe7_bin.go (about)

     1  // Copyright 2023 Dolthub, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package encodings
    16  
    17  // Swe7_bin_RuneWeight returns the weight of a given rune based on its relational sort order from
    18  // the `swe7_bin` collation.
    19  func Swe7_bin_RuneWeight(r rune) int32 {
    20  	weight, ok := swe7_bin_Weights[r]
    21  	if ok {
    22  		return weight
    23  	} else {
    24  		return 2147483647
    25  	}
    26  }
    27  
    28  // swe7_bin_Weights contain a map from rune to weight for the `swe7_bin` collation. The
    29  // map primarily contains mappings that have a random order. Mappings that fit into a sequential range (and are long
    30  // enough) are defined in the calling function to save space.
    31  var swe7_bin_Weights = map[rune]int32{
    32  	0:   0,
    33  	1:   1,
    34  	2:   2,
    35  	3:   3,
    36  	4:   4,
    37  	5:   5,
    38  	6:   6,
    39  	7:   7,
    40  	8:   8,
    41  	9:   9,
    42  	10:  10,
    43  	11:  11,
    44  	12:  12,
    45  	13:  13,
    46  	14:  14,
    47  	15:  15,
    48  	16:  16,
    49  	17:  17,
    50  	18:  18,
    51  	19:  19,
    52  	20:  20,
    53  	21:  21,
    54  	22:  22,
    55  	23:  23,
    56  	24:  24,
    57  	25:  25,
    58  	26:  26,
    59  	27:  27,
    60  	28:  28,
    61  	29:  29,
    62  	30:  30,
    63  	31:  31,
    64  	32:  32,
    65  	33:  33,
    66  	34:  34,
    67  	35:  35,
    68  	36:  36,
    69  	37:  37,
    70  	38:  38,
    71  	39:  39,
    72  	40:  40,
    73  	41:  41,
    74  	42:  42,
    75  	43:  43,
    76  	44:  44,
    77  	45:  45,
    78  	46:  46,
    79  	47:  47,
    80  	48:  48,
    81  	49:  49,
    82  	50:  50,
    83  	51:  51,
    84  	52:  52,
    85  	53:  53,
    86  	54:  54,
    87  	55:  55,
    88  	56:  56,
    89  	57:  57,
    90  	58:  58,
    91  	59:  59,
    92  	60:  60,
    93  	61:  61,
    94  	62:  62,
    95  	63:  63,
    96  	201: 64,
    97  	65:  65,
    98  	66:  66,
    99  	67:  67,
   100  	68:  68,
   101  	69:  69,
   102  	70:  70,
   103  	71:  71,
   104  	72:  72,
   105  	73:  73,
   106  	74:  74,
   107  	75:  75,
   108  	76:  76,
   109  	77:  77,
   110  	78:  78,
   111  	79:  79,
   112  	80:  80,
   113  	81:  81,
   114  	82:  82,
   115  	83:  83,
   116  	84:  84,
   117  	85:  85,
   118  	86:  86,
   119  	87:  87,
   120  	88:  88,
   121  	89:  89,
   122  	90:  90,
   123  	196: 91,
   124  	214: 92,
   125  	197: 93,
   126  	220: 94,
   127  	95:  95,
   128  	233: 96,
   129  	97:  97,
   130  	98:  98,
   131  	99:  99,
   132  	100: 100,
   133  	101: 101,
   134  	102: 102,
   135  	103: 103,
   136  	104: 104,
   137  	105: 105,
   138  	106: 106,
   139  	107: 107,
   140  	108: 108,
   141  	109: 109,
   142  	110: 110,
   143  	111: 111,
   144  	112: 112,
   145  	113: 113,
   146  	114: 114,
   147  	115: 115,
   148  	116: 116,
   149  	117: 117,
   150  	118: 118,
   151  	119: 119,
   152  	120: 120,
   153  	121: 121,
   154  	122: 122,
   155  	228: 123,
   156  	246: 124,
   157  	229: 125,
   158  	252: 126,
   159  }