github.com/dolthub/go-mysql-server@v0.18.0/sql/encodings/utf8mb3_unicode_520_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  // Utf8mb3_unicode_520_ci_RuneWeight returns the weight of a given rune based on its relational sort order from
    18  // the `utf8mb3_unicode_520_ci` collation.
    19  func Utf8mb3_unicode_520_ci_RuneWeight(r rune) int32 {
    20  	weight, ok := utf8mb3_unicode_520_ci_Weights()[r]
    21  	if ok {
    22  		return weight
    23  	} else if r >= 9003 && r <= 9192 {
    24  		return r - 7802
    25  	} else if r >= 9475 && r <= 9632 {
    26  		return r - 8031
    27  	} else if r >= 9676 && r <= 9775 {
    28  		return r - 8031
    29  	} else if r >= 10496 && r <= 10626 {
    30  		return r - 8365
    31  	} else if r >= 10765 && r <= 10867 {
    32  		return r - 8390
    33  	} else if r >= 10872 && r <= 10971 {
    34  		return r - 8393
    35  	} else if r >= 10974 && r <= 11084 {
    36  		return r - 8394
    37  	} else if r >= 10240 && r <= 10495 {
    38  		return r - 7533
    39  	} else if r >= 5121 && r <= 5499 {
    40  		return r + 2686
    41  	} else if r >= 5543 && r <= 5740 {
    42  		return r + 2694
    43  	} else if r >= 40960 && r <= 42124 {
    44  		return r - 31455
    45  	} else if r >= 20241 && r <= 20352 {
    46  		return r - 9252
    47  	} else if r >= 20416 && r <= 20523 {
    48  		return r - 9252
    49  	} else if r >= 20524 && r <= 20698 {
    50  		return r - 9252
    51  	} else if r >= 21571 && r <= 21693 {
    52  		return r - 9252
    53  	} else if r >= 21694 && r <= 21838 {
    54  		return r - 9252
    55  	} else if r >= 22121 && r <= 22230 {
    56  		return r - 9252
    57  	} else if r >= 22320 && r <= 22592 {
    58  		return r - 9252
    59  	} else if r >= 22900 && r <= 23138 {
    60  		return r - 9251
    61  	} else if r >= 23139 && r <= 23336 {
    62  		return r - 9251
    63  	} else if r >= 23665 && r <= 23833 {
    64  		return r - 9251
    65  	} else if r >= 23889 && r <= 23994 {
    66  		return r - 9251
    67  	} else if r >= 24062 && r <= 24177 {
    68  		return r - 9251
    69  	} else if r >= 25164 && r <= 25289 {
    70  		return r - 9250
    71  	} else if r >= 25343 && r <= 25467 {
    72  		return r - 9250
    73  	} else if r >= 25797 && r <= 25902 {
    74  		return r - 9250
    75  	} else if r >= 26793 && r <= 27138 {
    76  		return r - 9247
    77  	} else if r >= 27156 && r <= 27347 {
    78  		return r - 9247
    79  	} else if r >= 28187 && r <= 28316 {
    80  		return r - 9247
    81  	} else if r >= 28452 && r <= 28651 {
    82  		return r - 9247
    83  	} else if r >= 28890 && r <= 29001 {
    84  		return r - 9247
    85  	} else if r >= 30707 && r <= 30827 {
    86  		return r - 9247
    87  	} else if r >= 31521 && r <= 31630 {
    88  		return r - 9247
    89  	} else if r >= 31681 && r <= 31806 {
    90  		return r - 9247
    91  	} else if r >= 32415 && r <= 32565 {
    92  		return r - 9247
    93  	} else if r >= 32908 && r <= 33240 {
    94  		return r - 9247
    95  	} else if r >= 33402 && r <= 33509 {
    96  		return r - 9247
    97  	} else if r >= 33619 && r <= 33737 {
    98  		return r - 9247
    99  	} else if r >= 33880 && r <= 34030 {
   100  		return r - 9247
   101  	} else if r >= 34045 && r <= 34253 {
   102  		return r - 9247
   103  	} else if r >= 34411 && r <= 34681 {
   104  		return r - 9247
   105  	} else if r >= 34747 && r <= 34847 {
   106  		return r - 9247
   107  	} else if r >= 35328 && r <= 35498 {
   108  		return r - 9247
   109  	} else if r >= 35744 && r <= 35894 {
   110  		return r - 9247
   111  	} else if r >= 36336 && r <= 36522 {
   112  		return r - 9247
   113  	} else if r >= 36791 && r <= 36899 {
   114  		return r - 9247
   115  	} else if r >= 37495 && r <= 37636 {
   116  		return r - 9247
   117  	} else if r >= 37707 && r <= 38020 {
   118  		return r - 9247
   119  	} else if r >= 38021 && r <= 38262 {
   120  		return r - 9247
   121  	} else if r >= 39410 && r <= 39530 {
   122  		return r - 9247
   123  	} else if r >= 39792 && r <= 40023 {
   124  		return r - 9247
   125  	} else if r >= 40060 && r <= 40164 {
   126  		return r - 9247
   127  	} else if r >= 40165 && r <= 40372 {
   128  		return r - 9247
   129  	} else if r >= 13312 && r <= 15261 {
   130  		return r + 18323
   131  	} else if r >= 15262 && r <= 16408 {
   132  		return r + 18323
   133  	} else if r >= 16442 && r <= 19893 {
   134  		return r + 18323
   135  	} else if r >= 2111 && r <= 2303 {
   136  		return r + 36198
   137  	} else if r >= 11098 && r <= 11263 {
   138  		return r + 28650
   139  	} else if r >= 42893 && r <= 43002 {
   140  		return r - 2605
   141  	} else if r >= 43744 && r <= 43967 {
   142  		return r - 3217
   143  	} else if r >= 44026 && r <= 55215 {
   144  		return r - 3273
   145  	} else if r >= 57344 && r <= 63743 {
   146  		return r - 5393
   147  	} else {
   148  		return 2147483647
   149  	}
   150  }