From de1d1f715a151d2d94e89851d42fcf461970adc2 Mon Sep 17 00:00:00 2001 From: ZHAO Chun Date: Mon, 15 Apr 2019 11:01:26 +0800 Subject: [PATCH] Add readme for new documentation framework (#919) --- .../sql-functions/string-functions/ascii.md | 27 ++++++++++ .../sql-functions/string-functions/concat.md | 34 ++++++++++++ .../string-functions/concat_ws.md | 36 +++++++++++++ docs/readme.md | 52 +++++++++++++++++++ 4 files changed, 149 insertions(+) create mode 100644 docs/documentation/cn/sql-reference/sql-functions/string-functions/ascii.md create mode 100644 docs/documentation/cn/sql-reference/sql-functions/string-functions/concat.md create mode 100644 docs/documentation/cn/sql-reference/sql-functions/string-functions/concat_ws.md create mode 100644 docs/readme.md diff --git a/docs/documentation/cn/sql-reference/sql-functions/string-functions/ascii.md b/docs/documentation/cn/sql-reference/sql-functions/string-functions/ascii.md new file mode 100644 index 0000000000..2b45dc2f8b --- /dev/null +++ b/docs/documentation/cn/sql-reference/sql-functions/string-functions/ascii.md @@ -0,0 +1,27 @@ +# ascii + +## Description + +返回字符串第一个字符串对应的ascii 码 + +## Syntax + +`INT ascii(VARCHAR)` + +## Examples + +``` +mysql> select ascii('1'); ++------------+ +| ascii('1') | ++------------+ +| 49 | ++------------+ + +mysql> select ascii('234'); ++--------------+ +| ascii('234') | ++--------------+ +| 50 | ++--------------+ +``` diff --git a/docs/documentation/cn/sql-reference/sql-functions/string-functions/concat.md b/docs/documentation/cn/sql-reference/sql-functions/string-functions/concat.md new file mode 100644 index 0000000000..efd22dd28e --- /dev/null +++ b/docs/documentation/cn/sql-reference/sql-functions/string-functions/concat.md @@ -0,0 +1,34 @@ +# concat + +## Description + +将多个字符串连接起来, 如果参数中任意一个值是NULL,那么返回的结果就是NULL + +## Syntax + +`VARCHAR concat(VARCHAR,...)` + +## Examples + +``` +mysql> select concat("a", "b"); ++------------------+ +| concat('a', 'b') | ++------------------+ +| ab | ++------------------+ + +mysql> select concat("a", "b", "c"); ++-----------------------+ +| concat('a', 'b', 'c') | ++-----------------------+ +| abc | ++-----------------------+ + +mysql> select concat("a", null, "c"); ++------------------------+ +| concat('a', NULL, 'c') | ++------------------------+ +| NULL | ++------------------------+ +``` diff --git a/docs/documentation/cn/sql-reference/sql-functions/string-functions/concat_ws.md b/docs/documentation/cn/sql-reference/sql-functions/string-functions/concat_ws.md new file mode 100644 index 0000000000..a20b4d3c9e --- /dev/null +++ b/docs/documentation/cn/sql-reference/sql-functions/string-functions/concat_ws.md @@ -0,0 +1,36 @@ +# concat_ws + +## Description + +使用第一个参数作为连接符,将第二个参数以及后续所有参数拼接成一个字符串. +如果分隔符是NULL,返回NULL。 +`concat_ws`函数不会跳过空字符串,会跳过NULL值 + +## Syntax + +`VARCHAR concat_ws(VARCHAR, VARCHAR,...)` + +## Examples + +``` +mysql> select concat_ws("or", "d", "is"); ++----------------------------+ +| concat_ws('or', 'd', 'is') | ++----------------------------+ +| doris | ++----------------------------+ + +mysql> select concat_ws(NULL, "d", "is"); ++----------------------------+ +| concat_ws(NULL, 'd', 'is') | ++----------------------------+ +| NULL | ++----------------------------+ + +mysql> select concat_ws("or", "d", NULL,"is"); ++---------------------------------+ +| concat_ws("or", "d", NULL,"is") | ++---------------------------------+ +| doris | ++---------------------------------+ +``` diff --git a/docs/readme.md b/docs/readme.md new file mode 100644 index 0000000000..3bb894ecf0 --- /dev/null +++ b/docs/readme.md @@ -0,0 +1,52 @@ +## Philosophy + +**write once, use everywhere** + +Documentations will be written once, and will be converted to other format according to different application scenarios. + +## Implementation + +``` + +---------------+ + | Documentation | + +-------+-------+ + | + +-------+-------+ + | Doc Builder | + +-------+-------+ + | + +--------------------------------+ + | | | ++---+---+ +---+----+ +-----+----+ +| PDF | | HTML | .... | Help Doc | ++-------+ +--------+ +----------+ + +``` + +> Documentation:Text contents which is written by human. And this is the only place for documentation. +> Doc Builder: Tools that convert documentations to other format, such as PDF, HTML. There could be many tools, and we can use different tools to convert documentation to different formats. + +## Organization + +> `docs/documentation`: Root directory for documentation. And for different languages, there is a root directory for it. For example, `docs/documentation/cn` is the Chinese documentation's root directory. +> `docs/scripts`: Place of `Doc Builder`. +>  `docs/resources`: Resources that are referenced in documentation, such as pictures. + +## Constraints + +1. All documents are written in Markdown format, and file name is end with ".md". +2. All documents are started with level 1 title `# Title`, and should have only one level 1 title. +3. Names of file and directory are in lowercase letters, and use dashes as separator. +4. Documentation can be constructed as a directory or a single Markdown file, these two formats equal with each other in logical. Relationship is represented by parent-child directory in directory format, and by title level in file format. It is recommended to use directory format to manage a large documentation, because it is easy to maintain. +3. A directory corresponds to a title, and readme.md in this directory is its content. Other documents in this directory is its sub-sections. +4. For manual like section, such as function description, there should be `Description`, `Syntax`, `Examples` section in documents. + +## level directories + +1. doris-concepts +2. installing +3. getting-started +4. administrator-guide +5. sql-references +6. best-practices +7. internals