github.com/dolthub/go-mysql-server@v0.18.0/sql/encodings/latin1_general_cs.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  // Latin1_general_cs_RuneWeight returns the weight of a given rune based on its relational sort order from
    18  // the `latin1_general_cs` collation.
    19  func Latin1_general_cs_RuneWeight(r rune) int32 {
    20  	weight, ok := latin1_general_cs_Weights[r]
    21  	if ok {
    22  		return weight
    23  	} else {
    24  		return 2147483647
    25  	}
    26  }
    27  
    28  // latin1_general_cs_Weights contain a map from rune to weight for the `latin1_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 latin1_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  	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:   66,
    99  	192:  67,
   100  	224:  68,
   101  	193:  69,
   102  	225:  70,
   103  	194:  71,
   104  	226:  72,
   105  	195:  73,
   106  	227:  74,
   107  	196:  75,
   108  	228:  76,
   109  	197:  77,
   110  	229:  78,
   111  	198:  79,
   112  	230:  80,
   113  	66:   81,
   114  	98:   82,
   115  	67:   83,
   116  	99:   84,
   117  	199:  85,
   118  	231:  86,
   119  	68:   87,
   120  	100:  88,
   121  	208:  89,
   122  	240:  90,
   123  	69:   91,
   124  	101:  92,
   125  	200:  93,
   126  	232:  94,
   127  	201:  95,
   128  	233:  96,
   129  	202:  97,
   130  	234:  98,
   131  	203:  99,
   132  	235:  100,
   133  	70:   101,
   134  	102:  102,
   135  	71:   103,
   136  	103:  104,
   137  	72:   105,
   138  	104:  106,
   139  	73:   107,
   140  	105:  108,
   141  	204:  109,
   142  	236:  110,
   143  	205:  111,
   144  	237:  112,
   145  	206:  113,
   146  	238:  114,
   147  	207:  115,
   148  	239:  116,
   149  	74:   117,
   150  	106:  118,
   151  	75:   119,
   152  	107:  120,
   153  	76:   121,
   154  	108:  122,
   155  	77:   123,
   156  	109:  124,
   157  	78:   125,
   158  	110:  126,
   159  	209:  127,
   160  	241:  128,
   161  	79:   129,
   162  	111:  130,
   163  	210:  131,
   164  	242:  132,
   165  	211:  133,
   166  	243:  134,
   167  	212:  135,
   168  	244:  136,
   169  	213:  137,
   170  	245:  138,
   171  	214:  139,
   172  	246:  140,
   173  	216:  141,
   174  	248:  142,
   175  	80:   143,
   176  	112:  144,
   177  	81:   145,
   178  	113:  146,
   179  	82:   147,
   180  	114:  148,
   181  	83:   149,
   182  	115:  150,
   183  	223:  151,
   184  	84:   152,
   185  	116:  153,
   186  	85:   154,
   187  	117:  155,
   188  	217:  156,
   189  	249:  157,
   190  	218:  158,
   191  	250:  159,
   192  	219:  160,
   193  	251:  161,
   194  	220:  162,
   195  	252:  163,
   196  	86:   164,
   197  	118:  165,
   198  	87:   166,
   199  	119:  167,
   200  	88:   168,
   201  	120:  169,
   202  	89:   170,
   203  	121:  171,
   204  	221:  172,
   205  	253:  173,
   206  	255:  174,
   207  	90:   175,
   208  	122:  176,
   209  	222:  177,
   210  	254:  178,
   211  	91:   179,
   212  	92:   180,
   213  	93:   181,
   214  	94:   182,
   215  	95:   183,
   216  	96:   184,
   217  	123:  185,
   218  	124:  186,
   219  	125:  187,
   220  	126:  188,
   221  	215:  189,
   222  	247:  190,
   223  	127:  191,
   224  	8364: 192,
   225  	129:  193,
   226  	8218: 194,
   227  	402:  195,
   228  	8222: 196,
   229  	8230: 197,
   230  	8224: 198,
   231  	8225: 199,
   232  	710:  200,
   233  	8240: 201,
   234  	352:  202,
   235  	8249: 203,
   236  	338:  204,
   237  	141:  205,
   238  	381:  206,
   239  	143:  207,
   240  	144:  208,
   241  	8216: 209,
   242  	8217: 210,
   243  	8220: 211,
   244  	8221: 212,
   245  	8226: 213,
   246  	8211: 214,
   247  	8212: 215,
   248  	732:  216,
   249  	8482: 217,
   250  	353:  218,
   251  	8250: 219,
   252  	339:  220,
   253  	157:  221,
   254  	382:  222,
   255  	376:  223,
   256  	160:  224,
   257  	161:  225,
   258  	162:  226,
   259  	163:  227,
   260  	164:  228,
   261  	165:  229,
   262  	166:  230,
   263  	167:  231,
   264  	168:  232,
   265  	169:  233,
   266  	170:  234,
   267  	171:  235,
   268  	172:  236,
   269  	173:  237,
   270  	174:  238,
   271  	175:  239,
   272  	176:  240,
   273  	177:  241,
   274  	178:  242,
   275  	179:  243,
   276  	180:  244,
   277  	181:  245,
   278  	182:  246,
   279  	183:  247,
   280  	184:  248,
   281  	185:  249,
   282  	186:  250,
   283  	187:  251,
   284  	188:  252,
   285  	189:  253,
   286  	190:  254,
   287  	191:  255,
   288  }