github.com/dolthub/go-mysql-server@v0.18.0/sql/encodings/utf8mb4_roman_ci.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_roman_ci_RuneWeight returns the weight of a given rune based on its relational sort order from
    18  // the `utf8mb4_roman_ci` collation.
    19  func Utf8mb4_roman_ci_RuneWeight(r rune) int32 {
    20  	weight, ok := common_utf_roman_ci_Weights()[r]
    21  	if ok {
    22  		return weight
    23  	} else if r >= 9003 && r <= 9168 {
    24  		return r - 8070
    25  	} else if r >= 9475 && r <= 9632 {
    26  		return r - 8323
    27  	} else if r >= 10496 && r <= 10626 {
    28  		return r - 8775
    29  	} else if r >= 10765 && r <= 10867 {
    30  		return r - 8800
    31  	} else if r >= 10872 && r <= 10971 {
    32  		return r - 8803
    33  	} else if r >= 10240 && r <= 10495 {
    34  		return r - 8022
    35  	} else if r >= 5121 && r <= 5499 {
    36  		return r + 547
    37  	} else if r >= 5543 && r <= 5740 {
    38  		return r + 555
    39  	} else if r >= 40960 && r <= 42124 {
    40  		return r - 34154
    41  	} else if r >= 20241 && r <= 20358 {
    42  		return r - 11997
    43  	} else if r >= 20416 && r <= 20523 {
    44  		return r - 11997
    45  	} else if r >= 20524 && r <= 20698 {
    46  		return r - 11997
    47  	} else if r >= 21571 && r <= 21693 {
    48  		return r - 11997
    49  	} else if r >= 21694 && r <= 21895 {
    50  		return r - 11997
    51  	} else if r >= 22121 && r <= 22230 {
    52  		return r - 11997
    53  	} else if r >= 22320 && r <= 22592 {
    54  		return r - 11997
    55  	} else if r >= 22900 && r <= 23375 {
    56  		return r - 11996
    57  	} else if r >= 23665 && r <= 23833 {
    58  		return r - 11996
    59  	} else if r >= 23889 && r <= 23994 {
    60  		return r - 11996
    61  	} else if r >= 24062 && r <= 24177 {
    62  		return r - 11996
    63  	} else if r >= 24605 && r <= 24724 {
    64  		return r - 11995
    65  	} else if r >= 25164 && r <= 25289 {
    66  		return r - 11995
    67  	} else if r >= 25343 && r <= 25467 {
    68  		return r - 11995
    69  	} else if r >= 25505 && r <= 25754 {
    70  		return r - 11995
    71  	} else if r >= 25797 && r <= 25902 {
    72  		return r - 11995
    73  	} else if r >= 26793 && r <= 27138 {
    74  		return r - 11992
    75  	} else if r >= 27156 && r <= 27347 {
    76  		return r - 11992
    77  	} else if r >= 28187 && r <= 28316 {
    78  		return r - 11992
    79  	} else if r >= 28452 && r <= 28651 {
    80  		return r - 11992
    81  	} else if r >= 28671 && r <= 28778 {
    82  		return r - 11992
    83  	} else if r >= 28890 && r <= 29001 {
    84  		return r - 11992
    85  	} else if r >= 30466 && r <= 30682 {
    86  		return r - 11992
    87  	} else if r >= 30707 && r <= 30827 {
    88  		return r - 11992
    89  	} else if r >= 31521 && r <= 31680 {
    90  		return r - 11992
    91  	} else if r >= 31681 && r <= 31806 {
    92  		return r - 11992
    93  	} else if r >= 32048 && r <= 32160 {
    94  		return r - 11992
    95  	} else if r >= 32415 && r <= 32565 {
    96  		return r - 11992
    97  	} else if r >= 32908 && r <= 33240 {
    98  		return r - 11992
    99  	} else if r >= 33402 && r <= 33509 {
   100  		return r - 11992
   101  	} else if r >= 33591 && r <= 33737 {
   102  		return r - 11992
   103  	} else if r >= 33880 && r <= 34030 {
   104  		return r - 11992
   105  	} else if r >= 34045 && r <= 34253 {
   106  		return r - 11992
   107  	} else if r >= 34411 && r <= 34746 {
   108  		return r - 11992
   109  	} else if r >= 34747 && r <= 34847 {
   110  		return r - 11992
   111  	} else if r >= 35328 && r <= 35498 {
   112  		return r - 11992
   113  	} else if r >= 35744 && r <= 35894 {
   114  		return r - 11992
   115  	} else if r >= 36336 && r <= 36522 {
   116  		return r - 11992
   117  	} else if r >= 36791 && r <= 36899 {
   118  		return r - 11992
   119  	} else if r >= 37429 && r <= 37636 {
   120  		return r - 11992
   121  	} else if r >= 37707 && r <= 38020 {
   122  		return r - 11992
   123  	} else if r >= 38021 && r <= 38262 {
   124  		return r - 11992
   125  	} else if r >= 39410 && r <= 39530 {
   126  		return r - 11992
   127  	} else if r >= 39792 && r <= 40023 {
   128  		return r - 11992
   129  	} else if r >= 40060 && r <= 40164 {
   130  		return r - 11992
   131  	} else if r >= 40165 && r <= 40372 {
   132  		return r - 11992
   133  	} else if r >= 13312 && r <= 19893 {
   134  		return r + 15578
   135  	} else if r >= 1970 && r <= 2304 {
   136  		return r + 33718
   137  	} else if r >= 6517 && r <= 6623 {
   138  		return r + 30529
   139  	} else if r >= 6657 && r <= 7423 {
   140  		return r + 30497
   141  	} else if r >= 7533 && r <= 7679 {
   142  		return r + 30389
   143  	} else if r >= 11022 && r <= 11903 {
   144  		return r + 27427
   145  	} else if r >= 42183 && r <= 55295 {
   146  		return r - 2622
   147  	} else if r >= 57345 && r <= 63743 {
   148  		return r - 4670
   149  	} else if r >= 64107 && r <= 64255 {
   150  		return r - 5031
   151  	} else if r >= 65536 && r <= 1114111 {
   152  		return 59404
   153  	} else {
   154  		return 2147483647
   155  	}
   156  }