github.com/dolthub/go-mysql-server@v0.18.0/sql/encodings/ascii_general_ci.go (about) 1 // Copyright 2022 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 // Ascii_general_ci_RuneWeight returns the weight of a given rune based on its relational sort order from 18 // the `ascii_general_ci` collation. 19 func Ascii_general_ci_RuneWeight(r rune) int32 { 20 weight, ok := ascii_general_ci_Weights[r] 21 if ok { 22 return weight 23 } else { 24 return 2147483647 25 } 26 } 27 28 // ascii_general_ci_Weights contain a map from rune to weight for the `ascii_general_ci` 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 ascii_general_ci_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 64: 64, 97 65: 65, 98 97: 65, 99 66: 66, 100 98: 66, 101 67: 67, 102 99: 67, 103 68: 68, 104 100: 68, 105 69: 69, 106 101: 69, 107 70: 70, 108 102: 70, 109 71: 71, 110 103: 71, 111 72: 72, 112 104: 72, 113 73: 73, 114 105: 73, 115 74: 74, 116 106: 74, 117 75: 75, 118 107: 75, 119 76: 76, 120 108: 76, 121 77: 77, 122 109: 77, 123 78: 78, 124 110: 78, 125 79: 79, 126 111: 79, 127 80: 80, 128 112: 80, 129 81: 81, 130 113: 81, 131 82: 82, 132 114: 82, 133 83: 83, 134 115: 83, 135 84: 84, 136 116: 84, 137 85: 85, 138 117: 85, 139 86: 86, 140 118: 86, 141 87: 87, 142 119: 87, 143 88: 88, 144 120: 88, 145 89: 89, 146 121: 89, 147 90: 90, 148 122: 90, 149 91: 91, 150 92: 92, 151 93: 93, 152 94: 94, 153 95: 95, 154 96: 96, 155 123: 97, 156 124: 98, 157 125: 99, 158 126: 100, 159 127: 101, 160 }