Skip to content

Commit

Permalink
[Doc](function) Support uuid_to_int and int_to_uuid functions (apache…
Browse files Browse the repository at this point in the history
  • Loading branch information
zclllyybb authored Mar 29, 2024
1 parent 086c6ef commit 7bc9b3c
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 0 deletions.
47 changes: 47 additions & 0 deletions docs/sql-manual/sql-functions/string-functions/int-to-uuid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
{
"title": "INT_TO_UUID",
"language": "en"
}
---

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

## int_to_uuid

### description

`VARCHAR int_to_uuid(LARGEINT int128)`

For input encoded LARGEINT, translates to the original uuid string.

### example

```sql
mysql> select int_to_uuid(95721955514869408091759290071393952876);
+-----------------------------------------------------+
| int_to_uuid(95721955514869408091759290071393952876) |
+-----------------------------------------------------+
| 6ce4766f-6783-4b30-b357-bba1c7600348 |
+-----------------------------------------------------+
```

### keywords
INT_TO_UUID
47 changes: 47 additions & 0 deletions docs/sql-manual/sql-functions/string-functions/uuid-to-int.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
{
"title": "UUID_TO_INT",
"language": "en"
}
---

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

## uuid_to_int

### description

`LARGEINT uuid_to_int(VARCHAR uuid)`

Returns an int128 representation of the input uuid string.

### example

```sql
mysql> select uuid_to_int("6ce4766f-6783-4b30-b357-bba1c7600348");
+-----------------------------------------------------+
| uuid_to_int('6ce4766f-6783-4b30-b357-bba1c7600348') |
+-----------------------------------------------------+
| 95721955514869408091759290071393952876 |
+-----------------------------------------------------+
```

### keywords
UUID_TO_INT
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
{
"title": "INT_TO_UUID",
"language": "zh-CN"
}
---

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

## int_to_uuid

### description

`VARCHAR int_to_uuid(LARGEINT int128)`

对于输入的已编码 LARGEINT,转译为原始的 uuid 字符串。

### example

```sql
mysql> select int_to_uuid(95721955514869408091759290071393952876);
+-----------------------------------------------------+
| int_to_uuid(95721955514869408091759290071393952876) |
+-----------------------------------------------------+
| 6ce4766f-6783-4b30-b357-bba1c7600348 |
+-----------------------------------------------------+
```

### keywords
INT_TO_UUID
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
{
"title": "UUID_TO_INT",
"language": "zh-CN"
}
---

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

## uuid_to_int

### description

`LARGEINT uuid_to_int(VARCHAR uuid)`

对于输入的 uuid 字符串,返回一个 int128 表示。

### example

```sql
mysql> select uuid_to_int("6ce4766f-6783-4b30-b357-bba1c7600348");
+-----------------------------------------------------+
| uuid_to_int('6ce4766f-6783-4b30-b357-bba1c7600348') |
+-----------------------------------------------------+
| 95721955514869408091759290071393952876 |
+-----------------------------------------------------+
```

### keywords
UUID_TO_INT

0 comments on commit 7bc9b3c

Please sign in to comment.