github.com/dolthub/go-mysql-server@v0.18.0/sql/encodings/utf8mb4_zh_0900_as_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  // Utf8mb4_zh_0900_as_cs_RuneWeight returns the weight of a given rune based on its relational sort order from
    18  // the `utf8mb4_zh_0900_as_cs` collation.
    19  func Utf8mb4_zh_0900_as_cs_RuneWeight(r rune) int32 {
    20  	weight, ok := utf8mb4_zh_0900_as_cs_Weights()[r]
    21  	if ok {
    22  		return weight
    23  	} else if r >= 9003 && r <= 9214 {
    24  		return r - 7093
    25  	} else if r >= 9475 && r <= 9632 {
    26  		return r - 7299
    27  	} else if r >= 9676 && r <= 9775 {
    28  		return r - 7297
    29  	} else if r >= 9872 && r <= 9983 {
    30  		return r - 7314
    31  	} else if r >= 9984 && r <= 10087 {
    32  		return r - 7288
    33  	} else if r >= 10496 && r <= 10626 {
    34  		return r - 7600
    35  	} else if r >= 10765 && r <= 10867 {
    36  		return r - 7629
    37  	} else if r >= 10872 && r <= 10971 {
    38  		return r - 7632
    39  	} else if r >= 10974 && r <= 11123 {
    40  		return r - 7632
    41  	} else if r >= 10240 && r <= 10495 {
    42  		return r - 6652
    43  	} else if r >= 118784 && r <= 119029 {
    44  		return r - 114626
    45  	} else if r >= 127024 && r <= 127123 {
    46  		return r - 122325
    47  	} else if r >= 127744 && r <= 128511 {
    48  		return r - 122863
    49  	} else if r >= 128512 && r <= 128722 {
    50  		return r - 122781
    51  	} else if r >= 128768 && r <= 128883 {
    52  		return r - 122806
    53  	} else if r >= 120832 && r <= 121343 {
    54  		return r - 114521
    55  	} else if r >= 173824 && r <= 173980 {
    56  		return r - 95465
    57  	} else if r >= 173983 && r <= 174151 {
    58  		return r - 95466
    59  	} else if r >= 174255 && r <= 174601 {
    60  		return r - 95469
    61  	} else if r >= 174616 && r <= 174748 {
    62  		return r - 95471
    63  	} else if r >= 174751 && r <= 175800 {
    64  		return r - 95472
    65  	} else if r >= 175825 && r <= 176033 {
    66  		return r - 95474
    67  	} else if r >= 176036 && r <= 176224 {
    68  		return r - 95475
    69  	} else if r >= 176441 && r <= 176687 {
    70  		return r - 95481
    71  	} else if r >= 176690 && r <= 176847 {
    72  		return r - 95482
    73  	} else if r >= 177172 && r <= 177333 {
    74  		return r - 95496
    75  	} else if r >= 177423 && r <= 177591 {
    76  		return r - 95500
    77  	} else if r >= 177984 && r <= 178205 {
    78  		return r - 95533
    79  	} else if r >= 178258 && r <= 181499 {
    80  		return r - 95536
    81  	} else if r >= 181502 && r <= 181804 {
    82  		return r - 95537
    83  	} else if r >= 181807 && r <= 182564 {
    84  		return r - 95538
    85  	} else if r >= 182567 && r <= 183245 {
    86  		return r - 95539
    87  	} else if r >= 183248 && r <= 183842 {
    88  		return r - 95540
    89  	} else if r >= 183845 && r <= 183969 {
    90  		return r - 95541
    91  	} else if r >= 5121 && r <= 5499 {
    92  		return r + 91703
    93  	} else if r >= 5543 && r <= 5740 {
    94  		return r + 91711
    95  	} else if r >= 92160 && r <= 92728 {
    96  		return r + 6025
    97  	} else if r >= 124928 && r <= 125124 {
    98  		return r - 26144
    99  	} else if r >= 44033 && r <= 44619 {
   100  		return r + 55022
   101  	} else if r >= 44620 && r <= 45207 {
   102  		return r + 55025
   103  	} else if r >= 45209 && r <= 45795 {
   104  		return r + 55030
   105  	} else if r >= 45797 && r <= 46383 {
   106  		return r + 55035
   107  	} else if r >= 46384 && r <= 46971 {
   108  		return r + 55038
   109  	} else if r >= 46973 && r <= 47559 {
   110  		return r + 55043
   111  	} else if r >= 47561 && r <= 48147 {
   112  		return r + 55048
   113  	} else if r >= 48149 && r <= 48735 {
   114  		return r + 55053
   115  	} else if r >= 48736 && r <= 49323 {
   116  		return r + 55056
   117  	} else if r >= 49325 && r <= 49911 {
   118  		return r + 55061
   119  	} else if r >= 49912 && r <= 50499 {
   120  		return r + 55064
   121  	} else if r >= 50501 && r <= 50864 {
   122  		return r + 55069
   123  	} else if r >= 50865 && r <= 51087 {
   124  		return r + 55070
   125  	} else if r >= 51089 && r <= 51452 {
   126  		return r + 55075
   127  	} else if r >= 51453 && r <= 51675 {
   128  		return r + 55076
   129  	} else if r >= 51676 && r <= 52263 {
   130  		return r + 55079
   131  	} else if r >= 52281 && r <= 52851 {
   132  		return r + 55085
   133  	} else if r >= 52853 && r <= 53439 {
   134  		return r + 55090
   135  	} else if r >= 53441 && r <= 54027 {
   136  		return r + 55095
   137  	} else if r >= 54029 && r <= 54615 {
   138  		return r + 55100
   139  	} else if r >= 54617 && r <= 55203 {
   140  		return r + 55105
   141  	} else if r >= 40960 && r <= 42124 {
   142  		return r + 70267
   143  	} else if r >= 113664 && r <= 113770 {
   144  		return r - 590
   145  	} else if r >= 65664 && r <= 65786 {
   146  		return r + 47815
   147  	} else if r >= 67073 && r <= 67382 {
   148  		return r + 46530
   149  	} else if r >= 73728 && r <= 74338 {
   150  		return r + 40649
   151  	} else if r >= 74339 && r <= 74451 {
   152  		return r + 40651
   153  	} else if r >= 74455 && r <= 74649 {
   154  		return r + 40649
   155  	} else if r >= 74881 && r <= 75075 {
   156  		return r + 40419
   157  	} else if r >= 77825 && r <= 78894 {
   158  		return r + 37671
   159  	} else if r >= 82944 && r <= 83526 {
   160  		return r + 33680
   161  	} else if r >= 94209 && r <= 101119 {
   162  		return r + 22999
   163  	} else if r >= 57344 && r <= 63743 {
   164  		return r + 68431
   165  	} else if r >= 66046 && r <= 66175 {
   166  		return r + 66413
   167  	} else if r >= 66928 && r <= 67071 {
   168  		return r + 65787
   169  	} else if r >= 67432 && r <= 67583 {
   170  		return r + 65446
   171  	} else if r >= 68864 && r <= 69215 {
   172  		return r + 64576
   173  	} else if r >= 69248 && r <= 69631 {
   174  		return r + 64545
   175  	} else if r >= 70517 && r <= 70655 {
   176  		return r + 63861
   177  	} else if r >= 70874 && r <= 71039 {
   178  		return r + 63687
   179  	} else if r >= 71488 && r <= 71839 {
   180  		return r + 63380
   181  	} else if r >= 71936 && r <= 72383 {
   182  		return r + 63296
   183  	} else if r >= 72442 && r <= 72703 {
   184  		return r + 63239
   185  	} else if r >= 72887 && r <= 73727 {
   186  		return r + 63074
   187  	} else if r >= 74651 && r <= 74751 {
   188  		return r + 62152
   189  	} else if r >= 75076 && r <= 77823 {
   190  		return r + 61840
   191  	} else if r >= 78896 && r <= 82943 {
   192  		return r + 60769
   193  	} else if r >= 83528 && r <= 92159 {
   194  		return r + 60186
   195  	} else if r >= 93072 && r <= 93951 {
   196  		return r + 59411
   197  	} else if r >= 101120 && r <= 110591 {
   198  		return r + 52365
   199  	} else if r >= 110595 && r <= 113663 {
   200  		return r + 52363
   201  	} else if r >= 113828 && r <= 118783 {
   202  		return r + 52216
   203  	} else if r >= 119366 && r <= 119551 {
   204  		return r + 51669
   205  	} else if r >= 119666 && r <= 119807 {
   206  		return r + 51564
   207  	} else if r >= 121520 && r <= 122879 {
   208  		return r + 49896
   209  	} else if r >= 122923 && r <= 124927 {
   210  		return r + 49858
   211  	} else if r >= 125280 && r <= 126463 {
   212  		return r + 49558
   213  	} else if r >= 126706 && r <= 126975 {
   214  		return r + 49415
   215  	} else if r >= 127570 && r <= 127743 {
   216  		return r + 48940
   217  	} else if r >= 129473 && r <= 131071 {
   218  		return r + 47510
   219  	} else if r >= 183970 && r <= 194559 {
   220  		return r - 5334
   221  	} else if r >= 195103 && r <= 917504 {
   222  		return r - 5876
   223  	} else if r >= 917632 && r <= 917759 {
   224  		return r - 5973
   225  	} else if r >= 918001 && r <= 1114111 {
   226  		return r - 6213
   227  	} else if r >= 917760 && r <= 917999 {
   228  		return 0
   229  	} else {
   230  		return 2147483647
   231  	}
   232  }