github.com/dolthub/go-mysql-server@v0.18.0/sql/encodings/geostd8_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  // Geostd8_bin_RuneWeight returns the weight of a given rune based on its relational sort order from
    18  // the `geostd8_bin` collation.
    19  func Geostd8_bin_RuneWeight(r rune) int32 {
    20  	weight, ok := geostd8_bin_Weights[r]
    21  	if ok {
    22  		return weight
    23  	} else if r >= 0 && r <= 127 {
    24  		return r + 0
    25  	} else {
    26  		return 2147483647
    27  	}
    28  }
    29  
    30  // geostd8_bin_Weights contain a map from rune to weight for the `geostd8_bin` collation. The
    31  // map primarily contains mappings that have a random order. Mappings that fit into a sequential range (and are long
    32  // enough) are defined in the calling function to save space.
    33  var geostd8_bin_Weights = map[rune]int32{
    34  	8364: 128,
    35  	8218: 129,
    36  	8222: 130,
    37  	8230: 131,
    38  	8224: 132,
    39  	8225: 133,
    40  	8240: 134,
    41  	8249: 135,
    42  	8216: 136,
    43  	8217: 137,
    44  	8220: 138,
    45  	8221: 139,
    46  	8226: 140,
    47  	8211: 141,
    48  	8212: 142,
    49  	8250: 143,
    50  	160:  144,
    51  	161:  145,
    52  	162:  146,
    53  	163:  147,
    54  	164:  148,
    55  	165:  149,
    56  	166:  150,
    57  	167:  151,
    58  	168:  152,
    59  	169:  153,
    60  	170:  154,
    61  	171:  155,
    62  	172:  156,
    63  	173:  157,
    64  	174:  158,
    65  	175:  159,
    66  	176:  160,
    67  	177:  161,
    68  	178:  162,
    69  	179:  163,
    70  	180:  164,
    71  	181:  165,
    72  	182:  166,
    73  	183:  167,
    74  	184:  168,
    75  	185:  169,
    76  	186:  170,
    77  	187:  171,
    78  	188:  172,
    79  	189:  173,
    80  	190:  174,
    81  	191:  175,
    82  	4304: 176,
    83  	4305: 177,
    84  	4306: 178,
    85  	4307: 179,
    86  	4308: 180,
    87  	4309: 181,
    88  	4310: 182,
    89  	4337: 183,
    90  	4311: 184,
    91  	4312: 185,
    92  	4313: 186,
    93  	4314: 187,
    94  	4315: 188,
    95  	4316: 189,
    96  	4338: 190,
    97  	4317: 191,
    98  	4318: 192,
    99  	4319: 193,
   100  	4320: 194,
   101  	4321: 195,
   102  	4322: 196,
   103  	4339: 197,
   104  	4323: 198,
   105  	4324: 199,
   106  	4325: 200,
   107  	4326: 201,
   108  	4327: 202,
   109  	4328: 203,
   110  	4329: 204,
   111  	4330: 205,
   112  	4331: 206,
   113  	4332: 207,
   114  	4333: 208,
   115  	4334: 209,
   116  	4340: 210,
   117  	4335: 211,
   118  	4336: 212,
   119  	4341: 213,
   120  	8470: 214,
   121  }