github.com/dolthub/go-mysql-server@v0.18.0/sql/encodings/cp1257_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 // Cp1257_bin_RuneWeight returns the weight of a given rune based on its relational sort order from 18 // the `cp1257_bin` collation. 19 func Cp1257_bin_RuneWeight(r rune) int32 { 20 weight, ok := cp1257_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 // cp1257_bin_Weights contain a map from rune to weight for the `cp1257_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 cp1257_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 168: 136, 43 711: 137, 44 184: 138, 45 8216: 139, 46 8217: 140, 47 8220: 141, 48 8221: 142, 49 8226: 143, 50 8211: 144, 51 8212: 145, 52 8482: 146, 53 8250: 147, 54 175: 148, 55 731: 149, 56 160: 150, 57 162: 151, 58 163: 152, 59 164: 153, 60 166: 154, 61 167: 155, 62 216: 156, 63 169: 157, 64 342: 158, 65 171: 159, 66 172: 160, 67 173: 161, 68 174: 162, 69 198: 163, 70 176: 164, 71 177: 165, 72 178: 166, 73 179: 167, 74 180: 168, 75 181: 169, 76 182: 170, 77 183: 171, 78 248: 172, 79 185: 173, 80 343: 174, 81 187: 175, 82 188: 176, 83 189: 177, 84 190: 178, 85 230: 179, 86 260: 180, 87 302: 181, 88 256: 182, 89 262: 183, 90 196: 184, 91 197: 185, 92 280: 186, 93 274: 187, 94 268: 188, 95 201: 189, 96 377: 190, 97 278: 191, 98 290: 192, 99 310: 193, 100 298: 194, 101 315: 195, 102 352: 196, 103 323: 197, 104 325: 198, 105 211: 199, 106 332: 200, 107 213: 201, 108 214: 202, 109 215: 203, 110 370: 204, 111 321: 205, 112 346: 206, 113 362: 207, 114 220: 208, 115 379: 209, 116 381: 210, 117 223: 211, 118 261: 212, 119 303: 213, 120 257: 214, 121 263: 215, 122 228: 216, 123 229: 217, 124 281: 218, 125 275: 219, 126 269: 220, 127 233: 221, 128 378: 222, 129 279: 223, 130 291: 224, 131 311: 225, 132 299: 226, 133 316: 227, 134 353: 228, 135 324: 229, 136 326: 230, 137 243: 231, 138 333: 232, 139 245: 233, 140 246: 234, 141 247: 235, 142 371: 236, 143 322: 237, 144 347: 238, 145 363: 239, 146 252: 240, 147 380: 241, 148 382: 242, 149 729: 243, 150 }