From f87d80d9b0a44de9ba587f35288b6ac0cfe23dbd Mon Sep 17 00:00:00 2001 From: Simran Spiller Date: Thu, 4 Jan 2024 08:54:35 +0100 Subject: [PATCH 1/4] TO_CHAR() and REPEAT() string functions --- site/content/3.12/aql/functions/string.md | 51 +++++++++++++++++++ .../version-3.12/whats-new-in-3-12.md | 7 +++ 2 files changed, 58 insertions(+) diff --git a/site/content/3.12/aql/functions/string.md b/site/content/3.12/aql/functions/string.md index 638147f0e7..0d426bfe04 100644 --- a/site/content/3.12/aql/functions/string.md +++ b/site/content/3.12/aql/functions/string.md @@ -1233,6 +1233,35 @@ description: '' RETURN REGEX_REPLACE("An Avocado", "a", "_", true) ``` +## REPEAT() + +`REPEAT(value, count) → repeatedString` + +Repeat the input as many times as specified. + +- **value** (string): a string +- **count** (number): how often to repeat the `value` +- returns **repeatedString** (string): a new string with the `value` repeated + `count` times + +**Examples** + +```aql +--- +name: aqlRepeat_1 +description: '' +--- +RETURN REPEAT("foo ", 3) +``` + +```aql +--- +name: aqlRepeat_2 +description: '' +--- +RETURN REPEAT(5, 5) +``` + ## REVERSE() `REVERSE(value) → reversedString` @@ -1892,6 +1921,28 @@ RETURN [ ] ``` +## TO_CHAR() + +`TO_CHAR(codepoint) → character` + +Return the character with the specified codepoint. + +- **codepoint** (number): a Unicode codepoint +- returns **character** (string): the character with the specified codepoint + +**Examples** + +```aql +--- +name: aqlToChar +description: '' +--- +RETURN [ + TO_CHAR(216), + TO_CHAR(0x1F951) +] +``` + ## TO_HEX() `TO_HEX(value) → hexString` diff --git a/site/content/3.12/release-notes/version-3.12/whats-new-in-3-12.md b/site/content/3.12/release-notes/version-3.12/whats-new-in-3-12.md index 7bd2e11843..e86eeb8d38 100644 --- a/site/content/3.12/release-notes/version-3.12/whats-new-in-3-12.md +++ b/site/content/3.12/release-notes/version-3.12/whats-new-in-3-12.md @@ -182,6 +182,13 @@ less overhead. See [Document and object functions in AQL](../../aql/functions/document-object.md#parse_collection). +The new `REPEAT()` function repeats the input value a given number of times and +returns the resulting string. +The new `TO_CHAR()` functions lets you specify a numeric Unicode codepoint and +returns the corresponding character as a string. + +See [String functions in AQL](../../aql/functions/string.md#repeat). + ## Indexing ### Stored values can contain the `_id` attribute From 8652d7645482676a72f48e7db58fdf9313111e14 Mon Sep 17 00:00:00 2001 From: Simran Spiller Date: Thu, 4 Jan 2024 09:02:59 +0100 Subject: [PATCH 2/4] Separator parameter --- site/content/3.12/aql/functions/string.md | 20 ++++++++++++++----- .../version-3.12/whats-new-in-3-12.md | 4 ++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/site/content/3.12/aql/functions/string.md b/site/content/3.12/aql/functions/string.md index 0d426bfe04..3c477d523f 100644 --- a/site/content/3.12/aql/functions/string.md +++ b/site/content/3.12/aql/functions/string.md @@ -1235,14 +1235,16 @@ RETURN REGEX_REPLACE("An Avocado", "a", "_", true) ## REPEAT() -`REPEAT(value, count) → repeatedString` +`REPEAT(value, count, separator) → repeatedString` -Repeat the input as many times as specified. +Repeat the input as many times as specified, optionally with a separator. - **value** (string): a string - **count** (number): how often to repeat the `value` -- returns **repeatedString** (string): a new string with the `value` repeated - `count` times +- **separator** (string, *optional*): a string to place between repetitions +- returns **repeatedString** (string\|null): a new string with the `value` + repeated `count` times, or `null` and a warning if the output string exceeds + the limit of 16 MB **Examples** @@ -1251,7 +1253,7 @@ Repeat the input as many times as specified. name: aqlRepeat_1 description: '' --- -RETURN REPEAT("foo ", 3) +RETURN REPEAT("foo", 3) ``` ```aql @@ -1259,6 +1261,14 @@ RETURN REPEAT("foo ", 3) name: aqlRepeat_2 description: '' --- +RETURN REPEAT("foo", 3, " | ") +``` + +```aql +--- +name: aqlRepeat_3 +description: '' +--- RETURN REPEAT(5, 5) ``` diff --git a/site/content/3.12/release-notes/version-3.12/whats-new-in-3-12.md b/site/content/3.12/release-notes/version-3.12/whats-new-in-3-12.md index e86eeb8d38..d5c2bb5d56 100644 --- a/site/content/3.12/release-notes/version-3.12/whats-new-in-3-12.md +++ b/site/content/3.12/release-notes/version-3.12/whats-new-in-3-12.md @@ -182,8 +182,8 @@ less overhead. See [Document and object functions in AQL](../../aql/functions/document-object.md#parse_collection). -The new `REPEAT()` function repeats the input value a given number of times and -returns the resulting string. +The new `REPEAT()` function repeats the input value a given number of times, +optionally with a separator between repetitions, and returns the resulting string. The new `TO_CHAR()` functions lets you specify a numeric Unicode codepoint and returns the corresponding character as a string. From 82083bbdc77d55fb90505f5a0de585a2b8f91bff Mon Sep 17 00:00:00 2001 From: Simran Spiller Date: Thu, 4 Jan 2024 10:43:31 +0100 Subject: [PATCH 3/4] AQL RANDOM() alias for RAND() --- site/content/3.12/aql/functions/array.md | 6 +++--- site/content/3.12/aql/functions/document-object.md | 2 +- site/content/3.12/aql/functions/miscellaneous.md | 2 +- site/content/3.12/aql/functions/numeric.md | 10 +++++++--- site/content/3.12/aql/functions/string.md | 2 +- site/content/3.12/aql/functions/type-check-and-cast.md | 6 +++--- .../release-notes/version-3.12/whats-new-in-3-12.md | 2 ++ 7 files changed, 18 insertions(+), 12 deletions(-) diff --git a/site/content/3.12/aql/functions/array.md b/site/content/3.12/aql/functions/array.md index d21b39f201..bccdd70d36 100644 --- a/site/content/3.12/aql/functions/array.md +++ b/site/content/3.12/aql/functions/array.md @@ -65,11 +65,11 @@ RETURN APPEND([ 1, 2, 3 ], [ 3, 4, 5, 2, 9 ], true) ## CONTAINS_ARRAY() -This is an alias for [POSITION()](#position). +This is an alias for [`POSITION()`](#position). ## COUNT() -This is an alias for [LENGTH()](#length). +This is an alias for [`LENGTH()`](#length). ## COUNT_DISTINCT() @@ -100,7 +100,7 @@ RETURN COUNT_DISTINCT([ "yes", "no", "yes", "sauron", "no", "yes" ]) ## COUNT_UNIQUE() -This is an alias for [COUNT_DISTINCT()](#count_distinct). +This is an alias for [`COUNT_DISTINCT()`](#count_distinct). ## FIRST() diff --git a/site/content/3.12/aql/functions/document-object.md b/site/content/3.12/aql/functions/document-object.md index dc7e995b74..8f92b6e358 100644 --- a/site/content/3.12/aql/functions/document-object.md +++ b/site/content/3.12/aql/functions/document-object.md @@ -75,7 +75,7 @@ FOR attributeArray IN attributesPerDocument ## COUNT() -This is an alias for [LENGTH()](#length). +This is an alias for [`LENGTH()`](#length). ## HAS() diff --git a/site/content/3.12/aql/functions/miscellaneous.md b/site/content/3.12/aql/functions/miscellaneous.md index 2dbf3dae51..c837531136 100644 --- a/site/content/3.12/aql/functions/miscellaneous.md +++ b/site/content/3.12/aql/functions/miscellaneous.md @@ -139,7 +139,7 @@ Return an array of collections. ### COUNT() -This is an alias for [LENGTH()](#length). +This is an alias for [`LENGTH()`](#length). ### CURRENT_DATABASE() diff --git a/site/content/3.12/aql/functions/numeric.md b/site/content/3.12/aql/functions/numeric.md index 80e021931a..a2ba67ca3a 100644 --- a/site/content/3.12/aql/functions/numeric.md +++ b/site/content/3.12/aql/functions/numeric.md @@ -101,7 +101,7 @@ AVERAGE( [ 999, 80, 4, 4, 4, 3, 3, 3 ] ) // 137.5 ## AVG() -This is an alias for [AVERAGE()](#average). +This is an alias for [`AVERAGE()`](#average). ## CEIL() @@ -577,6 +577,10 @@ Result: ] ``` +## RANDOM() + +This is an alias for [`RAND()`](#rand). + ## RANGE() `RANGE(start, stop, step) → numArray` @@ -704,7 +708,7 @@ STDDEV_SAMPLE( [ 1, 3, 6, 5, 2 ] ) // 2.0736441353327724 ## STDDEV() -This is an alias for [STDDEV_POPULATION()](#stddev_population). +This is an alias for [`STDDEV_POPULATION()`](#stddev_population). ## SUM() @@ -769,4 +773,4 @@ VARIANCE_SAMPLE( [ 1, 3, 6, 5, 2 ] ) // 4.300000000000001 ## VARIANCE() -This is an alias for [VARIANCE_POPULATION()](#variance_population). +This is an alias for [`VARIANCE_POPULATION()`](#variance_population). diff --git a/site/content/3.12/aql/functions/string.md b/site/content/3.12/aql/functions/string.md index 3c477d523f..cea60984f0 100644 --- a/site/content/3.12/aql/functions/string.md +++ b/site/content/3.12/aql/functions/string.md @@ -281,7 +281,7 @@ RETURN CONTAINS("foobarbaz", "horse", true) ## COUNT() -This is an alias for [LENGTH()](#length). +This is an alias for [`LENGTH()`](#length). ## CRC32() diff --git a/site/content/3.12/aql/functions/type-check-and-cast.md b/site/content/3.12/aql/functions/type-check-and-cast.md index 8789a0ee5e..84e9ced5a5 100644 --- a/site/content/3.12/aql/functions/type-check-and-cast.md +++ b/site/content/3.12/aql/functions/type-check-and-cast.md @@ -140,7 +140,7 @@ TO_ARRAY({foo: 1, bar: 2, baz: [3, 4, 5]}) // [1, 2, [3, 4, 5]] `TO_LIST(value) → array` -This is an alias for [TO_ARRAY()](#to_array). +This is an alias for [`TO_ARRAY()`](#to_array). ## Type check functions @@ -205,7 +205,7 @@ Check whether *value* is an array / list `IS_LIST(value) → bool` -This is an alias for [IS_ARRAY()](#is_array) +This is an alias for [`IS_ARRAY()`](#is_array) ### IS_OBJECT() @@ -221,7 +221,7 @@ Check whether *value* is an object / document `IS_DOCUMENT(value) → bool` -This is an alias for [IS_OBJECT()](#is_object) +This is an alias for [`IS_OBJECT()`](#is_object) ### IS_DATESTRING() diff --git a/site/content/3.12/release-notes/version-3.12/whats-new-in-3-12.md b/site/content/3.12/release-notes/version-3.12/whats-new-in-3-12.md index d5c2bb5d56..ccebc12241 100644 --- a/site/content/3.12/release-notes/version-3.12/whats-new-in-3-12.md +++ b/site/content/3.12/release-notes/version-3.12/whats-new-in-3-12.md @@ -189,6 +189,8 @@ returns the corresponding character as a string. See [String functions in AQL](../../aql/functions/string.md#repeat). +A numeric function `RANDOM()` has been added as an alias for the existing `RAND()`. + ## Indexing ### Stored values can contain the `_id` attribute From 4aa88551f11dbdcfac3f46a146b1088cc2350961 Mon Sep 17 00:00:00 2001 From: CircleCI Job Date: Fri, 5 Jan 2024 07:08:01 +0000 Subject: [PATCH 4/4] [skip ci] Automatic commit of generated files from CircleCI --- site/data/3.12/cache.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/site/data/3.12/cache.json b/site/data/3.12/cache.json index a1ab2bd84c..66b9637738 100644 --- a/site/data/3.12/cache.json +++ b/site/data/3.12/cache.json @@ -2575,6 +2575,18 @@ "request": "LS0tCm5hbWU6IGFxbFJlZ2V4VGVzdF8zCmRlc2NyaXB0aW9uOiAnJwotLS0KUkVUVVJOIFJFR0VYX1RFU1QoInRoZVxcbnF1aWNrXFxuYnJvd25cXG5mb3giLCAiXnRoZShcXG5bYS13XSspK1xcbmZveCQiKQ==", "response": "eyJpbnB1dCI6IlJFVFVSTiBSRUdFWF9URVNUKFwidGhlXFxcXG5xdWlja1xcXFxuYnJvd25cXFxcbmZveFwiLCBcIl50aGUoXFxcXG5bYS13XSspK1xcXFxuZm94JFwiKSIsIm91dHB1dCI6IltvYmplY3QgQXJhbmdvUXVlcnlDdXJzb3IsIGNvdW50OiAxLCBjYWNoZWQ6IGZhbHNlLCBoYXNNb3JlOiBmYWxzZV1cblxuWyBcbiAgdHJ1ZSBcbl0iLCJlcnJvciI6IiIsIm9wdGlvbnMiOnsiZGVzY3JpcHRpb24iOiIiLCJuYW1lIjoiYXFsUmVnZXhUZXN0XzMiLCJ0eXBlIjoic2luZ2xlIiwicmVuZGVyIjoiaW5wdXQvb3V0cHV0In19Cg==" }, + "aqlRepeat_1_single": { + "request": "LS0tCm5hbWU6IGFxbFJlcGVhdF8xCmRlc2NyaXB0aW9uOiAnJwotLS0KUkVUVVJOIFJFUEVBVCgiZm9vIiwgMyk=", + "response": "eyJpbnB1dCI6IlJFVFVSTiBSRVBFQVQoXCJmb29cIiwgMykiLCJvdXRwdXQiOiJbIFxuICBcImZvb2Zvb2Zvb1wiIFxuXSIsImVycm9yIjoiIiwib3B0aW9ucyI6eyJkZXNjcmlwdGlvbiI6IiIsIm5hbWUiOiJhcWxSZXBlYXRfMSIsInR5cGUiOiJzaW5nbGUiLCJyZW5kZXIiOiJpbnB1dC9vdXRwdXQifX0K" + }, + "aqlRepeat_2_single": { + "request": "LS0tCm5hbWU6IGFxbFJlcGVhdF8yCmRlc2NyaXB0aW9uOiAnJwotLS0KUkVUVVJOIFJFUEVBVCgiZm9vIiwgMywgIiB8ICIp", + "response": "eyJpbnB1dCI6IlJFVFVSTiBSRVBFQVQoXCJmb29cIiwgMywgXCIgfCBcIikiLCJvdXRwdXQiOiJbIFxuICBcImZvbyB8IGZvbyB8IGZvb1wiIFxuXSIsImVycm9yIjoiIiwib3B0aW9ucyI6eyJkZXNjcmlwdGlvbiI6IiIsIm5hbWUiOiJhcWxSZXBlYXRfMiIsInR5cGUiOiJzaW5nbGUiLCJyZW5kZXIiOiJpbnB1dC9vdXRwdXQifX0K" + }, + "aqlRepeat_3_single": { + "request": "LS0tCm5hbWU6IGFxbFJlcGVhdF8zCmRlc2NyaXB0aW9uOiAnJwotLS0KUkVUVVJOIFJFUEVBVCg1LCA1KQ==", + "response": "eyJpbnB1dCI6IlJFVFVSTiBSRVBFQVQoNSwgNSkiLCJvdXRwdXQiOiJbIFxuICBcIjU1NTU1XCIgXG5dIiwiZXJyb3IiOiIiLCJvcHRpb25zIjp7ImRlc2NyaXB0aW9uIjoiIiwibmFtZSI6ImFxbFJlcGVhdF8zIiwidHlwZSI6InNpbmdsZSIsInJlbmRlciI6ImlucHV0L291dHB1dCJ9fQo=" + }, "aqlReverse_1_single": { "request": "LS0tCm5hbWU6IGFxbFJldmVyc2VfMQpkZXNjcmlwdGlvbjogJycKLS0tClJFVFVSTiBSRVZFUlNFKCJmb29iYXIiKQ==", "response": "eyJpbnB1dCI6IlJFVFVSTiBSRVZFUlNFKFwiZm9vYmFyXCIpIiwib3V0cHV0IjoiW29iamVjdCBBcmFuZ29RdWVyeUN1cnNvciwgY291bnQ6IDEsIGNhY2hlZDogZmFsc2UsIGhhc01vcmU6IGZhbHNlXVxuXG5bIFxuICBcInJhYm9vZlwiIFxuXSIsImVycm9yIjoiIiwib3B0aW9ucyI6eyJkZXNjcmlwdGlvbiI6IiIsIm5hbWUiOiJhcWxSZXZlcnNlXzEiLCJ0eXBlIjoic2luZ2xlIiwicmVuZGVyIjoiaW5wdXQvb3V0cHV0In19Cg==" @@ -2715,6 +2727,10 @@ "request": "LS0tCm5hbWU6IGFxbFRvQmFzZTY0CmRlc2NyaXB0aW9uOiAnJwotLS0KUkVUVVJOIFsKICBUT19CQVNFNjQoIkFCQy4iKSwKICBUT19CQVNFNjQoIjEyMzQ1NiIpCl0=", "response": "eyJpbnB1dCI6IlJFVFVSTiBbXG4gIFRPX0JBU0U2NChcIkFCQy5cIiksXG4gIFRPX0JBU0U2NChcIjEyMzQ1NlwiKVxuXSIsIm91dHB1dCI6IltvYmplY3QgQXJhbmdvUXVlcnlDdXJzb3IsIGNvdW50OiAxLCBjYWNoZWQ6IGZhbHNlLCBoYXNNb3JlOiBmYWxzZV1cblxuWyBcbiAgWyBcbiAgICBcIlFVSkRMZz09XCIsIFxuICAgIFwiTVRJek5EVTJcIiBcbiAgXSBcbl0iLCJlcnJvciI6IiIsIm9wdGlvbnMiOnsiZGVzY3JpcHRpb24iOiIiLCJuYW1lIjoiYXFsVG9CYXNlNjQiLCJ0eXBlIjoic2luZ2xlIiwicmVuZGVyIjoiaW5wdXQvb3V0cHV0In19Cg==" }, + "aqlToChar_single": { + "request": "LS0tCm5hbWU6IGFxbFRvQ2hhcgpkZXNjcmlwdGlvbjogJycKLS0tClJFVFVSTiBbCiAgVE9fQ0hBUigyMTYpLAogIFRPX0NIQVIoMHgxRjk1MSkKXQ==", + "response": "eyJpbnB1dCI6IlJFVFVSTiBbXG4gIFRPX0NIQVIoMjE2KSxcbiAgVE9fQ0hBUigweDFGOTUxKVxuXSIsIm91dHB1dCI6IlsgXG4gIFsgXG4gICAgXCLDmFwiLCBcbiAgICBcIvCfpZFcIiBcbiAgXSBcbl0iLCJlcnJvciI6IiIsIm9wdGlvbnMiOnsiZGVzY3JpcHRpb24iOiIiLCJuYW1lIjoiYXFsVG9DaGFyIiwidHlwZSI6InNpbmdsZSIsInJlbmRlciI6ImlucHV0L291dHB1dCJ9fQo=" + }, "aqlToHex_single": { "request": "LS0tCm5hbWU6IGFxbFRvSGV4CmRlc2NyaXB0aW9uOiAnJwotLS0KUkVUVVJOIFsKICBUT19IRVgoIkFCQy4iKSwKICBUT19IRVgoIsO8IikKXQ==", "response": "eyJpbnB1dCI6IlJFVFVSTiBbXG4gIFRPX0hFWChcIkFCQy5cIiksXG4gIFRPX0hFWChcIsO8XCIpXG5dIiwib3V0cHV0IjoiW29iamVjdCBBcmFuZ29RdWVyeUN1cnNvciwgY291bnQ6IDEsIGNhY2hlZDogZmFsc2UsIGhhc01vcmU6IGZhbHNlXVxuXG5bIFxuICBbIFxuICAgIFwiNDE0MjQzMmVcIiwgXG4gICAgXCJjM2JjXCIgXG4gIF0gXG5dIiwiZXJyb3IiOiIiLCJvcHRpb25zIjp7ImRlc2NyaXB0aW9uIjoiIiwibmFtZSI6ImFxbFRvSGV4IiwidHlwZSI6InNpbmdsZSIsInJlbmRlciI6ImlucHV0L291dHB1dCJ9fQo="