DOCS-679: netloc function (#12321)

* DOCSUP-1377 (netloc function) (#135)

* add EN description

* changes in query

* changes after review

* add RU description

* CLICKHOUSEDOCS-679: Text fixes.

Co-authored-by: Sergei Shtykov <bayonet@yandex-team.ru>
Co-authored-by: emironyuk <em@don.ru>
Co-authored-by: Evgenia Sudarikova <56156889+otrazhenia@users.noreply.github.com>
This commit is contained in:
BayoNet 2020-07-09 11:50:53 +03:00 committed by GitHub
parent 827990d681
commit 2eb6f1d0c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 72 additions and 0 deletions

View File

@ -184,6 +184,42 @@ SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS Decod
└────────────────────────────────────────┘
```
### netloc {#netloc}
Extracts network locality (`username:password@host:port`) from a URL.
**Syntax**
```sql
netloc(URL)
```
**Parameters**
- `url` — URL. [String](../../sql-reference/data-types/string.md).
**Returned value**
- `username:password@host:port`.
Type: `String`.
**Example**
Query:
``` sql
SELECT netloc('http://paul@www.example.com:80/');
```
Result:
``` text
┌─netloc('http://paul@www.example.com:80/')─┐
│ paul@www.example.com:80 │
└───────────────────────────────────────────┘
```
## Functions that Remove Part of a URL {#functions-that-remove-part-of-a-url}
If the URL doesnt have anything similar, the URL remains unchanged.

View File

@ -174,6 +174,42 @@ SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS Decod
└────────────────────────────────────────┘
```
### netloc {#netloc}
Извлекает сетевую локальность (`username:password@host:port`) из URL.
**Синтаксис**
```sql
netloc(URL)
```
**Параметры**
- `url` — URL. Тип — [String](../../sql-reference/data-types/string.md).
**Возвращаемое значение**
- `username:password@host:port`.
Тип: `String`.
**Пример**
Запрос:
``` sql
SELECT netloc('http://paul@www.example.com:80/');
```
Результат:
``` text
┌─netloc('http://paul@www.example.com:80/')─┐
│ paul@www.example.com:80 │
└───────────────────────────────────────────┘
```
## Функции, удаляющие часть из URL-а {#funktsii-udaliaiushchie-chast-iz-url-a}
Если в URL-е нет ничего похожего, то URL остаётся без изменений.