github.com/dolthub/go-mysql-server@v0.18.0/sql/encodings/latin7_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  // Latin7_bin_RuneWeight returns the weight of a given rune based on its relational sort order from
    18  // the `latin7_bin` collation.
    19  func Latin7_bin_RuneWeight(r rune) int32 {
    20  	weight, ok := latin7_bin_Weights[r]
    21  	if ok {
    22  		return weight
    23  	} else if r >= 0 && r <= 160 {
    24  		return r + 0
    25  	} else {
    26  		return 2147483647
    27  	}
    28  }
    29  
    30  // latin7_bin_Weights contain a map from rune to weight for the `latin7_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 latin7_bin_Weights = map[rune]int32{
    34  	8221: 161,
    35  	162:  162,
    36  	163:  163,
    37  	164:  164,
    38  	8222: 165,
    39  	166:  166,
    40  	167:  167,
    41  	216:  168,
    42  	169:  169,
    43  	342:  170,
    44  	171:  171,
    45  	172:  172,
    46  	173:  173,
    47  	174:  174,
    48  	198:  175,
    49  	176:  176,
    50  	177:  177,
    51  	178:  178,
    52  	179:  179,
    53  	8220: 180,
    54  	181:  181,
    55  	182:  182,
    56  	183:  183,
    57  	248:  184,
    58  	185:  185,
    59  	343:  186,
    60  	187:  187,
    61  	188:  188,
    62  	189:  189,
    63  	190:  190,
    64  	230:  191,
    65  	260:  192,
    66  	302:  193,
    67  	256:  194,
    68  	262:  195,
    69  	196:  196,
    70  	197:  197,
    71  	280:  198,
    72  	274:  199,
    73  	268:  200,
    74  	201:  201,
    75  	377:  202,
    76  	278:  203,
    77  	290:  204,
    78  	310:  205,
    79  	298:  206,
    80  	315:  207,
    81  	352:  208,
    82  	323:  209,
    83  	325:  210,
    84  	211:  211,
    85  	332:  212,
    86  	213:  213,
    87  	214:  214,
    88  	215:  215,
    89  	370:  216,
    90  	321:  217,
    91  	346:  218,
    92  	362:  219,
    93  	220:  220,
    94  	379:  221,
    95  	381:  222,
    96  	223:  223,
    97  	261:  224,
    98  	303:  225,
    99  	257:  226,
   100  	263:  227,
   101  	228:  228,
   102  	229:  229,
   103  	281:  230,
   104  	275:  231,
   105  	269:  232,
   106  	233:  233,
   107  	378:  234,
   108  	279:  235,
   109  	291:  236,
   110  	311:  237,
   111  	299:  238,
   112  	316:  239,
   113  	353:  240,
   114  	324:  241,
   115  	326:  242,
   116  	243:  243,
   117  	333:  244,
   118  	245:  245,
   119  	246:  246,
   120  	247:  247,
   121  	371:  248,
   122  	322:  249,
   123  	347:  250,
   124  	363:  251,
   125  	252:  252,
   126  	380:  253,
   127  	382:  254,
   128  	8217: 255,
   129  }