github.com/dolthub/go-mysql-server@v0.18.0/sql/encodings/cp1256_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 // Cp1256_bin_RuneWeight returns the weight of a given rune based on its relational sort order from 18 // the `cp1256_bin` collation. 19 func Cp1256_bin_RuneWeight(r rune) int32 { 20 weight, ok := cp1256_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 // cp1256_bin_Weights contain a map from rune to weight for the `cp1256_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 cp1256_bin_Weights = map[rune]int32{ 34 8364: 128, 35 1662: 129, 36 8218: 130, 37 402: 131, 38 8222: 132, 39 8230: 133, 40 8224: 134, 41 8225: 135, 42 710: 136, 43 8240: 137, 44 8249: 138, 45 338: 139, 46 1670: 140, 47 1688: 141, 48 1711: 142, 49 8216: 143, 50 8217: 144, 51 8220: 145, 52 8221: 146, 53 8226: 147, 54 8211: 148, 55 8212: 149, 56 8482: 150, 57 8250: 151, 58 339: 152, 59 8204: 153, 60 8205: 154, 61 160: 155, 62 1548: 156, 63 162: 157, 64 163: 158, 65 164: 159, 66 165: 160, 67 166: 161, 68 167: 162, 69 168: 163, 70 169: 164, 71 171: 165, 72 172: 166, 73 173: 167, 74 174: 168, 75 175: 169, 76 176: 170, 77 177: 171, 78 178: 172, 79 179: 173, 80 180: 174, 81 181: 175, 82 182: 176, 83 183: 177, 84 184: 178, 85 185: 179, 86 1563: 180, 87 187: 181, 88 188: 182, 89 189: 183, 90 190: 184, 91 1567: 185, 92 1569: 186, 93 1570: 187, 94 1571: 188, 95 1572: 189, 96 1573: 190, 97 1574: 191, 98 1575: 192, 99 1576: 193, 100 1577: 194, 101 1578: 195, 102 1579: 196, 103 1580: 197, 104 1581: 198, 105 1582: 199, 106 1583: 200, 107 1584: 201, 108 1585: 202, 109 1586: 203, 110 1587: 204, 111 1588: 205, 112 1589: 206, 113 1590: 207, 114 215: 208, 115 1591: 209, 116 1592: 210, 117 1593: 211, 118 1594: 212, 119 1600: 213, 120 1601: 214, 121 1602: 215, 122 1603: 216, 123 224: 217, 124 1604: 218, 125 226: 219, 126 1605: 220, 127 1606: 221, 128 1607: 222, 129 1608: 223, 130 231: 224, 131 232: 225, 132 233: 226, 133 234: 227, 134 235: 228, 135 1609: 229, 136 1610: 230, 137 238: 231, 138 239: 232, 139 1611: 233, 140 1612: 234, 141 1613: 235, 142 1614: 236, 143 244: 237, 144 1615: 238, 145 1616: 239, 146 247: 240, 147 1617: 241, 148 249: 242, 149 1618: 243, 150 251: 244, 151 252: 245, 152 8206: 246, 153 8207: 247, 154 }