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