From d734fb51507a0d46ccd749fa7ebb830aff9996f0 Mon Sep 17 00:00:00 2001 From: Micha de Vries Date: Thu, 19 Sep 2024 15:34:31 +0100 Subject: [PATCH] fix syntax examples --- .../introduction/concepts/database.mdx | 4 +-- .../introduction/concepts/namespace.mdx | 6 ++-- .../doc-surrealdb/introduction/sql.mdx | 28 +++++++++---------- .../doc-surrealql/datamodel/closures.mdx | 2 +- src/content/doc-surrealql/operators.mdx | 6 ++-- .../doc-surrealql/statements/alter.mdx | 2 +- .../doc-surrealql/statements/begin.mdx | 2 +- .../doc-surrealql/statements/break.mdx | 8 +++--- .../doc-surrealql/statements/cancel.mdx | 4 +-- .../doc-surrealql/statements/commit.mdx | 4 +-- .../doc-surrealql/statements/continue.mdx | 6 ++-- .../doc-surrealql/statements/create.mdx | 2 +- .../statements/define/access/index.mdx | 2 +- .../statements/define/access/jwt.mdx | 2 +- .../statements/define/access/record.mdx | 2 +- .../statements/define/analyzer.mdx | 4 +-- .../statements/define/database.mdx | 2 +- .../doc-surrealql/statements/define/event.mdx | 2 +- .../doc-surrealql/statements/define/field.mdx | 2 +- .../statements/define/function.mdx | 2 +- .../doc-surrealql/statements/define/index.mdx | 2 +- .../statements/define/indexes.mdx | 2 +- .../statements/define/namespace.mdx | 2 +- .../doc-surrealql/statements/define/param.mdx | 2 +- .../doc-surrealql/statements/define/scope.mdx | 2 +- .../doc-surrealql/statements/define/table.mdx | 2 +- .../doc-surrealql/statements/define/token.mdx | 2 +- .../doc-surrealql/statements/define/user.mdx | 2 +- .../doc-surrealql/statements/delete.mdx | 10 +++---- src/content/doc-surrealql/statements/for.mdx | 2 +- src/content/doc-surrealql/statements/info.mdx | 6 ++-- .../doc-surrealql/statements/insert.mdx | 14 +++++----- src/content/doc-surrealql/statements/kill.mdx | 4 +-- src/content/doc-surrealql/statements/let.mdx | 2 +- .../doc-surrealql/statements/live_select.mdx | 4 +-- .../doc-surrealql/statements/rebuild.mdx | 2 +- .../doc-surrealql/statements/relate.mdx | 2 +- .../doc-surrealql/statements/remove.mdx | 2 +- .../doc-surrealql/statements/return.mdx | 2 +- .../doc-surrealql/statements/select.mdx | 2 +- src/content/doc-surrealql/statements/show.mdx | 4 +-- .../doc-surrealql/statements/sleep.mdx | 4 +-- .../doc-surrealql/statements/throw.mdx | 4 +-- .../doc-surrealql/statements/update.mdx | 2 +- .../doc-surrealql/statements/upsert.mdx | 2 +- src/content/doc-surrealql/statements/use.mdx | 4 +-- 46 files changed, 90 insertions(+), 90 deletions(-) diff --git a/src/content/doc-surrealdb/introduction/concepts/database.mdx b/src/content/doc-surrealdb/introduction/concepts/database.mdx index f9f3ea1db..c09d1bbf3 100644 --- a/src/content/doc-surrealdb/introduction/concepts/database.mdx +++ b/src/content/doc-surrealdb/introduction/concepts/database.mdx @@ -13,7 +13,7 @@ A database within SurrealDB is contained within a [namespace](/docs/surrealdb/in Databases are defined using the [`DEFINE DATABASE`](/docs/surrealql/statements/define/database) statement in SurrealQL. The statement requires a unique name for the database and can optionally include a comment for additional context. The following is the syntax for defining a database: -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" DEFINE DATABASE [ OVERWRITE | IF NOT EXISTS ] @name [ COMMENT @string ] ``` @@ -38,4 +38,4 @@ You can also view the list of databases in your SurrealDB instance using the [`I ## Learn more -To learn more about databases and how to use them in SurrealDB, refer to the [`DEFINE DATABASE`](/docs/surrealql/statements/define/database). \ No newline at end of file +To learn more about databases and how to use them in SurrealDB, refer to the [`DEFINE DATABASE`](/docs/surrealql/statements/define/database). diff --git a/src/content/doc-surrealdb/introduction/concepts/namespace.mdx b/src/content/doc-surrealdb/introduction/concepts/namespace.mdx index 98b97533b..73594bbf4 100644 --- a/src/content/doc-surrealdb/introduction/concepts/namespace.mdx +++ b/src/content/doc-surrealdb/introduction/concepts/namespace.mdx @@ -18,7 +18,7 @@ There is no limit to the number of namespaces on SurrealDB and each namespace ca Namespaces are defined using the [`DEFINE NAMESPACE`](/docs/surrealql/statements/define/namespace) statement in SurrealQL. The statement requires a unique name for the namespace and can optionally include a comment for additional context. The following is the syntax for defining a namespace: -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" DEFINE NAMESPACE [ OVERWRITE | IF NOT EXISTS ] @name [ COMMENT @string ] ``` @@ -26,7 +26,7 @@ You can also view the list of namespaces in your SurrealDB instance using the [` Using the [`NAMESPACE`](/docs/surrealql/statements/info) or [`NS`](/docs/surrealql/statements/info) keyword. -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" INFO FOR [ NS | NAMESPACE ]; ``` @@ -43,7 +43,7 @@ By running the command above, you will get info ONLY about the current namespace Once a namespace has been defined, the command below you will get a list of all the namespaces in your SurrealDB instance. We are still using the [`INFO`](/docs/surrealql/statements/info) statement, but we are asking for the info for [`ROOT`](/docs/surrealql/statements/info). The output will include the namespace name and a list of namespace users. -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" INFO FOR ROOT; ``` diff --git a/src/content/doc-surrealdb/introduction/sql.mdx b/src/content/doc-surrealdb/introduction/sql.mdx index 31ab40806..70d58137a 100644 --- a/src/content/doc-surrealdb/introduction/sql.mdx +++ b/src/content/doc-surrealdb/introduction/sql.mdx @@ -23,7 +23,7 @@ For more in-depth explanations of SurrealDB concepts, see the [concepts page](/d Relational databases SurrealDB - + @@ -108,7 +108,7 @@ For more SurrealQL examples, see the [create](/docs/surrealql/statements/create) SQL SurrealQL - + @@ -148,7 +148,7 @@ For more SurrealQL examples, see the [select](/docs/surrealql/statements/select) SQL SurrealQL - + @@ -171,20 +171,20 @@ For more SurrealQL examples, see the [select](/docs/surrealql/statements/select) SELECT name FROM person WHERE name = "Jane" - SELECT name FROM person WHERE name = "Jane" + SELECT name FROM person WHERE name = "Jane" - EXPLAIN SELECT name FROM person WHERE name = "Jane" + EXPLAIN SELECT name FROM person WHERE name = "Jane" - SELECT name FROM person WHERE name = "Jane" EXPLAIN + SELECT name FROM person WHERE name = "Jane" EXPLAIN - SELECT count(*) AS person_count FROM person + SELECT count(*) AS person_count FROM person SELECT count() AS person_count FROM person GROUP ALL @@ -192,7 +192,7 @@ For more SurrealQL examples, see the [select](/docs/surrealql/statements/select) - SELECT DISTINCT name FROM person + SELECT DISTINCT name FROM person SELECT array::distinct(name) FROM person GROUP ALL @@ -200,7 +200,7 @@ For more SurrealQL examples, see the [select](/docs/surrealql/statements/select) - SELECT * FROM person LIMIT 10 + SELECT * FROM person LIMIT 10 SELECT * FROM person LIMIT 10 @@ -208,10 +208,10 @@ For more SurrealQL examples, see the [select](/docs/surrealql/statements/select) - SELECT review.*, person.name as reviewer FROM review INNER JOIN review.person_id = person.id + SELECT review.*, person.name as reviewer FROM review INNER JOIN review.person_id = person.id - SELECT *, person.name as reviewer FROM review + SELECT *, person.name as reviewer FROM review @@ -228,7 +228,7 @@ For more SurrealQL examples, see the [update](/docs/surrealql/statements/update) SQL SurrealQL - + @@ -268,7 +268,7 @@ For more SurrealQL examples, see the [delete](/docs/surrealql/statements/delete) SQL SurrealQL - + @@ -295,4 +295,4 @@ For more SurrealQL examples, see the [delete](/docs/surrealql/statements/delete) - \ No newline at end of file + diff --git a/src/content/doc-surrealql/datamodel/closures.mdx b/src/content/doc-surrealql/datamodel/closures.mdx index e7aac027c..9d1bd368b 100644 --- a/src/content/doc-surrealql/datamodel/closures.mdx +++ b/src/content/doc-surrealql/datamodel/closures.mdx @@ -10,7 +10,7 @@ import Since from '@components/Since.astro' -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" $@parameter = |@parameters| @expression; ``` diff --git a/src/content/doc-surrealql/operators.mdx b/src/content/doc-surrealql/operators.mdx index 361aff939..48f977d67 100644 --- a/src/content/doc-surrealql/operators.mdx +++ b/src/content/doc-surrealql/operators.mdx @@ -834,7 +834,7 @@ Below are the details for each method, including how to format your query with e Best for smaller datasets or when the highest accuracy is required. -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" <|K,DISTANCE_METRIC|> ``` @@ -852,7 +852,7 @@ SELECT id FROM pts WHERE point <|2,EUCLIDEAN|> [2,3,4,5]; Ideal for larger datasets where performance is crucial, and a consistent distance metric can be predefined. -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" <|K|> ``` @@ -870,7 +870,7 @@ SELECT id FROM pts WHERE point <|2|> [2,3,4,5]; Recommended for very large datasets where speed is essential and some loss of accuracy is acceptable. -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" <|K,EF|> ``` diff --git a/src/content/doc-surrealql/statements/alter.mdx b/src/content/doc-surrealql/statements/alter.mdx index 49fbb2c34..320bf829e 100644 --- a/src/content/doc-surrealql/statements/alter.mdx +++ b/src/content/doc-surrealql/statements/alter.mdx @@ -16,7 +16,7 @@ The `ALTER` statement can be used to change definitions for defined resources. > [!NOTE] > Currently, the `ALTER` statement only supports modifying tables and their properties - `ALTER TABLE`, but will be expanded to include other resources. -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" ALTER [ | TABLE [ IF NOT EXISTS ] @name [ DROP ] diff --git a/src/content/doc-surrealql/statements/begin.mdx b/src/content/doc-surrealql/statements/begin.mdx index 16801116e..6a1aa15d3 100644 --- a/src/content/doc-surrealql/statements/begin.mdx +++ b/src/content/doc-surrealql/statements/begin.mdx @@ -11,7 +11,7 @@ Each statement within SurrealDB is run within its own transaction by default. Th ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" BEGIN [ TRANSACTION ]; ``` diff --git a/src/content/doc-surrealql/statements/break.mdx b/src/content/doc-surrealql/statements/break.mdx index c6529047d..6c2220ad4 100644 --- a/src/content/doc-surrealql/statements/break.mdx +++ b/src/content/doc-surrealql/statements/break.mdx @@ -11,7 +11,7 @@ The BREAK statement can be used to break out of a loop, such as inside one creat ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" BREAK ``` @@ -27,12 +27,12 @@ LET $numbers = [1,2,3,4,5,6,7,8,9]; FOR $num IN $numbers { IF $num > 5 { BREAK; - + } ELSE IF $num < 5 { CREATE type::thing( 'person', $num ) CONTENT { - name: "Person number " + $num + name: "Person number " + $num }; }; }; @@ -77,4 +77,4 @@ FOR $data IN array::sort::desc($weather) { CREATE weather CONTENT $data; }; }; -``` \ No newline at end of file +``` diff --git a/src/content/doc-surrealql/statements/cancel.mdx b/src/content/doc-surrealql/statements/cancel.mdx index ea56c8099..ea37e1eab 100644 --- a/src/content/doc-surrealql/statements/cancel.mdx +++ b/src/content/doc-surrealql/statements/cancel.mdx @@ -11,7 +11,7 @@ Each statement within SurrealDB is run within its own transaction. If a set of c ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" CANCEL [ TRANSACTION ]; ``` @@ -52,4 +52,4 @@ IF account:two.balance < 0 { }; COMMIT TRANSACTION; -``` \ No newline at end of file +``` diff --git a/src/content/doc-surrealql/statements/commit.mdx b/src/content/doc-surrealql/statements/commit.mdx index 40a87eb36..3b2a64b6e 100644 --- a/src/content/doc-surrealql/statements/commit.mdx +++ b/src/content/doc-surrealql/statements/commit.mdx @@ -11,7 +11,7 @@ Each statement within SurrealDB is run within its own transaction by default. If ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" COMMIT [ TRANSACTION ]; ``` @@ -37,4 +37,4 @@ COMMIT TRANSACTION; The following two options can be used at any point if a transaction must be cancelled without commiting the changes: * [CANCEL](/docs/surrealql/statements/cancel) to manually cancel the transaction, -* [THROW](/docs/surrealql/statements/throw) to cancel a transaction with an optional error message. THROW is the only way to cancel a transaction based on a condition, such as inside an [IF..ELSE](/docs/surrealql/statements/ifelse) block. \ No newline at end of file +* [THROW](/docs/surrealql/statements/throw) to cancel a transaction with an optional error message. THROW is the only way to cancel a transaction based on a condition, such as inside an [IF..ELSE](/docs/surrealql/statements/ifelse) block. diff --git a/src/content/doc-surrealql/statements/continue.mdx b/src/content/doc-surrealql/statements/continue.mdx index 0a38e5d6a..ff15b70ca 100644 --- a/src/content/doc-surrealql/statements/continue.mdx +++ b/src/content/doc-surrealql/statements/continue.mdx @@ -11,7 +11,7 @@ The CONTINUE statement can be used to skip an iteration of a loop, like within t ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" CONTINUE ``` @@ -66,7 +66,7 @@ FOR $data IN $weather { IF $data IS NONE { CONTINUE; }; - + CREATE weather CONTENT $data; }; -``` \ No newline at end of file +``` diff --git a/src/content/doc-surrealql/statements/create.mdx b/src/content/doc-surrealql/statements/create.mdx index 92deb4546..fb5157e84 100644 --- a/src/content/doc-surrealql/statements/create.mdx +++ b/src/content/doc-surrealql/statements/create.mdx @@ -16,7 +16,7 @@ The `CREATE` statement can be used to add a record to the database. If the recor ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" CREATE [ ONLY ] @targets [ CONTENT @value | SET @field = @value ... diff --git a/src/content/doc-surrealql/statements/define/access/index.mdx b/src/content/doc-surrealql/statements/define/access/index.mdx index 8f4595b0f..141cb5b10 100644 --- a/src/content/doc-surrealql/statements/define/access/index.mdx +++ b/src/content/doc-surrealql/statements/define/access/index.mdx @@ -19,7 +19,7 @@ Defining an access method allows SurrealDB to grant access to resources using di ## Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" DEFINE ACCESS [ OVERWRITE | IF NOT EXISTS ] @name ON [ ROOT | NAMESPACE | DATABASE ] TYPE [ diff --git a/src/content/doc-surrealql/statements/define/access/jwt.mdx b/src/content/doc-surrealql/statements/define/access/jwt.mdx index 4f86e9afe..d59c45557 100644 --- a/src/content/doc-surrealql/statements/define/access/jwt.mdx +++ b/src/content/doc-surrealql/statements/define/access/jwt.mdx @@ -27,7 +27,7 @@ Bear in mind that table and field permissions only apply to [record users](/docs ## Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" DEFINE ACCESS [ OVERWRITE | IF NOT EXISTS ] @name ON [ ROOT | NAMESPACE | DATABASE ] TYPE JWT [ ALGORITHM @algorithm KEY @key | URL @url ] diff --git a/src/content/doc-surrealql/statements/define/access/record.mdx b/src/content/doc-surrealql/statements/define/access/record.mdx index d1be652d6..6db430fa9 100644 --- a/src/content/doc-surrealql/statements/define/access/record.mdx +++ b/src/content/doc-surrealql/statements/define/access/record.mdx @@ -22,7 +22,7 @@ Record users allow SurrealDB to operate as a web database by offering mechanisms ## Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" DEFINE ACCESS [ OVERWRITE | IF NOT EXISTS ] @name ON DATABASE TYPE RECORD [ SIGNUP @expression ] diff --git a/src/content/doc-surrealql/statements/define/analyzer.mdx b/src/content/doc-surrealql/statements/define/analyzer.mdx index 6159c12db..4dc6e146a 100644 --- a/src/content/doc-surrealql/statements/define/analyzer.mdx +++ b/src/content/doc-surrealql/statements/define/analyzer.mdx @@ -8,7 +8,7 @@ import Since from '@components/Since.astro' # `DEFINE ANALYZER` statement -In the context of a database, an analyzer plays a crucial role in text processing and searching. It is defined by its name, a set of tokenizers, and a collection of filters. +In the context of a database, an analyzer plays a crucial role in text processing and searching. It is defined by its name, a set of tokenizers, and a collection of filters. The output of an analyzer can be experimented with by using the [`search::analyze()`](/docs/surrealql/functions/database/search#searchhighlight) function. @@ -18,7 +18,7 @@ The output of an analyzer can be experimented with by using the [`search::analyz ## Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" DEFINE ANALYZER [ OVERWRITE | IF NOT EXISTS ] @name [ TOKENIZERS @tokenizers ] [ FILTERS @filters ] [ COMMENT @string ] ``` diff --git a/src/content/doc-surrealql/statements/define/database.mdx b/src/content/doc-surrealql/statements/define/database.mdx index ae8682bf6..38735acb7 100644 --- a/src/content/doc-surrealql/statements/define/database.mdx +++ b/src/content/doc-surrealql/statements/define/database.mdx @@ -17,7 +17,7 @@ The `DEFINE DATABASE` statement allows you to instantiate a named database, enab ## Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" DEFINE DATABASE [ OVERWRITE | IF NOT EXISTS ] @name [ COMMENT @string ] ``` diff --git a/src/content/doc-surrealql/statements/define/event.mdx b/src/content/doc-surrealql/statements/define/event.mdx index 0eb3d19e4..10fa00f09 100644 --- a/src/content/doc-surrealql/statements/define/event.mdx +++ b/src/content/doc-surrealql/statements/define/event.mdx @@ -18,7 +18,7 @@ Events can be triggered after any change or modification to the data in a record ## Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" DEFINE EVENT [ OVERWRITE | IF NOT EXISTS ] @name ON [ TABLE ] @table [ WHEN @expression ] THEN @expression [ COMMENT @string ] ``` diff --git a/src/content/doc-surrealql/statements/define/field.mdx b/src/content/doc-surrealql/statements/define/field.mdx index 7f96bcf7a..5fb1d713c 100644 --- a/src/content/doc-surrealql/statements/define/field.mdx +++ b/src/content/doc-surrealql/statements/define/field.mdx @@ -18,7 +18,7 @@ The `DEFINE FIELD` statement allows you to instantiate a named field on a table, ## Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" DEFINE FIELD [ OVERWRITE | IF NOT EXISTS ] @name ON [ TABLE ] @table [ [ FLEXIBLE ] TYPE @type ] [ DEFAULT @expression ] diff --git a/src/content/doc-surrealql/statements/define/function.mdx b/src/content/doc-surrealql/statements/define/function.mdx index d6137eabf..29c6487fe 100644 --- a/src/content/doc-surrealql/statements/define/function.mdx +++ b/src/content/doc-surrealql/statements/define/function.mdx @@ -21,7 +21,7 @@ Functions can be used to encapsulate logic that you want to reuse in multiple qu ## Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" DEFINE FUNCTION [ OVERWRITE | IF NOT EXISTS ] fn::@name( [ @argument: @type ... ] ) { [ @query ... ] [ RETURN @returned ] diff --git a/src/content/doc-surrealql/statements/define/index.mdx b/src/content/doc-surrealql/statements/define/index.mdx index 4eb5ed2dd..0f7d31280 100644 --- a/src/content/doc-surrealql/statements/define/index.mdx +++ b/src/content/doc-surrealql/statements/define/index.mdx @@ -9,7 +9,7 @@ description: The DEFINE statement can be used to specify authentication access a The DEFINE statement can be used to specify instructions to the schema such as authentication access and behaviour, global parameters, table configurations, table events, analyzers, and indexes. -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" DEFINE [ NAMESPACE [ OVERWRITE | IF NOT EXISTS ] @name | DATABASE [ OVERWRITE | IF NOT EXISTS ] @name diff --git a/src/content/doc-surrealql/statements/define/indexes.mdx b/src/content/doc-surrealql/statements/define/indexes.mdx index 132e7e07e..03c5ccf0c 100644 --- a/src/content/doc-surrealql/statements/define/indexes.mdx +++ b/src/content/doc-surrealql/statements/define/indexes.mdx @@ -19,7 +19,7 @@ Just like in other databases, SurrealDB uses indexes to help optimize query perf ## Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" DEFINE INDEX [ OVERWRITE | IF NOT EXISTS ] @name ON [ TABLE ] @table [ FIELDS | COLUMNS ] @fields [ UNIQUE diff --git a/src/content/doc-surrealql/statements/define/namespace.mdx b/src/content/doc-surrealql/statements/define/namespace.mdx index d35898d80..ddbf2781b 100644 --- a/src/content/doc-surrealql/statements/define/namespace.mdx +++ b/src/content/doc-surrealql/statements/define/namespace.mdx @@ -18,7 +18,7 @@ Let's say that you're using SurrealDB to create a multi-tenant SaaS application. ## Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" DEFINE NAMESPACE [ OVERWRITE | IF NOT EXISTS ] @name [ COMMENT @string ] ``` diff --git a/src/content/doc-surrealql/statements/define/param.mdx b/src/content/doc-surrealql/statements/define/param.mdx index 062791a56..d34c7b6ad 100644 --- a/src/content/doc-surrealql/statements/define/param.mdx +++ b/src/content/doc-surrealql/statements/define/param.mdx @@ -18,7 +18,7 @@ The `DEFINE PARAM` statement allows you to define global (database-wide) paramet ## Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" DEFINE PARAM [ OVERWRITE | IF NOT EXISTS ] $@name VALUE @value [ COMMENT @string ] ``` diff --git a/src/content/doc-surrealql/statements/define/scope.mdx b/src/content/doc-surrealql/statements/define/scope.mdx index c1fc37f60..dda4ecc7e 100644 --- a/src/content/doc-surrealql/statements/define/scope.mdx +++ b/src/content/doc-surrealql/statements/define/scope.mdx @@ -21,7 +21,7 @@ Setting scope access allows SurrealDB to operate as a web database. With scopes ## Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" DEFINE SCOPE [ OVERWRITE | IF NOT EXISTS ] @name SESSION @duration SIGNUP @expression SIGNIN @expression [ COMMENT @string ] ``` diff --git a/src/content/doc-surrealql/statements/define/table.mdx b/src/content/doc-surrealql/statements/define/table.mdx index 647206ada..fbc50dd42 100644 --- a/src/content/doc-surrealql/statements/define/table.mdx +++ b/src/content/doc-surrealql/statements/define/table.mdx @@ -17,7 +17,7 @@ The `DEFINE TABLE` statement allows you to declare your table by name, enabling ## Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" DEFINE TABLE [ OVERWRITE | IF NOT EXISTS ] @name [ DROP ] [ SCHEMAFULL | SCHEMALESS ] diff --git a/src/content/doc-surrealql/statements/define/token.mdx b/src/content/doc-surrealql/statements/define/token.mdx index a7692813c..559847fd1 100644 --- a/src/content/doc-surrealql/statements/define/token.mdx +++ b/src/content/doc-surrealql/statements/define/token.mdx @@ -16,7 +16,7 @@ SurrealDB can work with third-party authentication providers such as OpenID Conn This verification is performed automatically by SurrealDB when provided with a JWT through any of its interfaces (i.e. the [HTTP REST API](/docs/surrealdb/integration/http) through the “Authorization” header or [any of the SDKs](/docs/surrealdb/integration/sdks) through the “Authenticate” methods) before trusting the claims contained in the token and allowing SurrealQL queries to access the values of those claims. -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" DEFINE TOKEN [ OVERWRITE | IF NOT EXISTS ] @name ON [ NAMESPACE | DATABASE | SCOPE @scope ] TYPE @type VALUE @value [ COMMENT @string ] ``` diff --git a/src/content/doc-surrealql/statements/define/user.mdx b/src/content/doc-surrealql/statements/define/user.mdx index d3c8dd771..c643af8eb 100644 --- a/src/content/doc-surrealql/statements/define/user.mdx +++ b/src/content/doc-surrealql/statements/define/user.mdx @@ -30,7 +30,7 @@ Use the `DEFINE USER` statement to create system users on SurrealDB ## Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" DEFINE USER [ OVERWRITE | IF NOT EXISTS ] @name ON [ ROOT | NAMESPACE | DATABASE ] [ PASSWORD @pass | PASSHASH @hash ] diff --git a/src/content/doc-surrealql/statements/delete.mdx b/src/content/doc-surrealql/statements/delete.mdx index ab6cb90f7..09d321aaa 100644 --- a/src/content/doc-surrealql/statements/delete.mdx +++ b/src/content/doc-surrealql/statements/delete.mdx @@ -11,7 +11,7 @@ The `DELETE` statement can be used to delete records from the database. ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" DELETE [ ONLY ] @targets [ WHERE @condition ] [ RETURN NONE | RETURN BEFORE | RETURN AFTER | RETURN DIFF | RETURN @statement_param, ... ] @@ -112,7 +112,7 @@ SELECT * FROM cat; This pattern is particularly useful when using SurrealDB's [literal types](/docs/surrealql/datamodel/literals) which were added in version 2.0. A literal type containing objects that contain a single top-level field can easily be matched on through the field name. ```surql -DEFINE FIELD error_info ON TABLE info TYPE +DEFINE FIELD error_info ON TABLE info TYPE { continue: { message: "Continue" } } | { retry_with_id: { error: string } } | { deprecated: { message: string } }; @@ -173,11 +173,11 @@ DELETE person:tobie->bought WHERE out=product:iphone; While soft deletions do not exist natively in SurrealDB, they can be simulated by [defining an event](/docs/surrealql/statements/define/event) that reacts whenever a deletion occurs. -The following example archives the data of a deleted record in another table so that it is +The following example archives the data of a deleted record in another table so that it is ```surql DEFINE EVENT archive_person ON TABLE person WHEN $event = "DELETE" THEN { - CREATE deleted_person SET + CREATE deleted_person SET data = $before, deleted_at = time::now() }; @@ -215,4 +215,4 @@ SELECT * FROM deleted_person; id: deleted_person:p3fpzhpxuu9jvjn8juyf } ] -``` \ No newline at end of file +``` diff --git a/src/content/doc-surrealql/statements/for.mdx b/src/content/doc-surrealql/statements/for.mdx index 6733843e6..05d04ff57 100644 --- a/src/content/doc-surrealql/statements/for.mdx +++ b/src/content/doc-surrealql/statements/for.mdx @@ -15,7 +15,7 @@ The `FOR` statement can be used to iterate over the values of an array, and to p > A `FOR` loop currently cannot access items outside its own scope, such as variables declared before the loop. -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" FOR @item IN @iterable { @block }; diff --git a/src/content/doc-surrealql/statements/info.mdx b/src/content/doc-surrealql/statements/info.mdx index b4dda8ac4..b195d2bd1 100644 --- a/src/content/doc-surrealql/statements/info.mdx +++ b/src/content/doc-surrealql/statements/info.mdx @@ -9,7 +9,7 @@ description: The INFO command outputs information about the setup of the Surreal The `INFO` command outputs information about the setup of the SurrealDB system. There are a number of different `INFO` commands for retrieving the configuration at the different levels of the database. -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" INFO FOR [ ROOT | NS | NAMESPACE @@ -27,7 +27,7 @@ There are a number of different `INFO` commands for retrieving the configuration ## System information -### Root information +### Root information The top-level ROOT command returns information regarding the users and namespaces which exists within the SurrealDB system. > [!NOTE] @@ -217,4 +217,4 @@ INFO FOR TABLE user STRUCTURE; lives: [], tables: [] } -``` \ No newline at end of file +``` diff --git a/src/content/doc-surrealql/statements/insert.mdx b/src/content/doc-surrealql/statements/insert.mdx index 741c69713..59d85332d 100644 --- a/src/content/doc-surrealql/statements/insert.mdx +++ b/src/content/doc-surrealql/statements/insert.mdx @@ -12,7 +12,7 @@ The `INSERT` statement can be used to insert or update data into the database, u ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" INSERT [ IGNORE ] INTO [ RELATION ] @what [ @value | (@fields) VALUES (@values) @@ -160,13 +160,13 @@ INSERT INTO company { You can also return specific fields from a created record, as well as ad-hoc fields to modify the output as needed. ```surql -INSERT INTO person { - age: 46, - username : "john-smith", +INSERT INTO person { + age: 46, + username : "john-smith", interests : ['skiing', 'music'] } -RETURN - age, - interests, +RETURN + age, + interests, age + 1 AS age_next_year; ``` diff --git a/src/content/doc-surrealql/statements/kill.mdx b/src/content/doc-surrealql/statements/kill.mdx index cb4080060..5f4b78fa4 100644 --- a/src/content/doc-surrealql/statements/kill.mdx +++ b/src/content/doc-surrealql/statements/kill.mdx @@ -13,7 +13,7 @@ While the `KILL` statement does accept a value type, this value must resolve to ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" KILL @value; ``` @@ -51,4 +51,4 @@ KILL u'9276b05b-e59a-49cd-9dd1-17c6fd15c28f'; ```bash title="Output" "Can not execute KILL statement using id '$rand'" "Can not execute KILL statement using id 'u'9276b05b-e59a-49cd-9dd1-17c6fd15c28f''" -``` \ No newline at end of file +``` diff --git a/src/content/doc-surrealql/statements/let.mdx b/src/content/doc-surrealql/statements/let.mdx index 23427d8fe..90e874072 100644 --- a/src/content/doc-surrealql/statements/let.mdx +++ b/src/content/doc-surrealql/statements/let.mdx @@ -15,7 +15,7 @@ The `LET` statement allows you to create parameters to store any value, includin The syntax for the `LET` statement is straightforward. The parameter name is prefixed with a `$` symbol. -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" LET $@parameter [: @type_name] = @value; ``` diff --git a/src/content/doc-surrealql/statements/live_select.mdx b/src/content/doc-surrealql/statements/live_select.mdx index 710024206..f5af1e399 100644 --- a/src/content/doc-surrealql/statements/live_select.mdx +++ b/src/content/doc-surrealql/statements/live_select.mdx @@ -13,7 +13,7 @@ In practical terms, when you execute a `LIVE SELECT` query, it triggers an ongoi ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" LIVE SELECT [ [ VALUE ] @fields [ AS @alias ] @@ -44,7 +44,7 @@ The result of the above query will be a UUID. This UUID is the Live Query Unique You can find an example of such a message in the [Live Query WebSocket protocol](/docs/surrealdb/integration/rpc#live-websocket-only) description. -### Diff +### Diff When using the `DIFF` mode, updates will be sent in the form of an array with [JSON Patch](https://jsonpatch.com/) messages. diff --git a/src/content/doc-surrealql/statements/rebuild.mdx b/src/content/doc-surrealql/statements/rebuild.mdx index 50311e828..1e1de98be 100644 --- a/src/content/doc-surrealql/statements/rebuild.mdx +++ b/src/content/doc-surrealql/statements/rebuild.mdx @@ -18,7 +18,7 @@ Rebuilding the index will ensure the index is fully optimized. ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" REBUILD [ INDEX [ IF EXISTS ] @name ON [ TABLE ] @table ] diff --git a/src/content/doc-surrealql/statements/relate.mdx b/src/content/doc-surrealql/statements/relate.mdx index 3cf3162d0..65b9363a2 100644 --- a/src/content/doc-surrealql/statements/relate.mdx +++ b/src/content/doc-surrealql/statements/relate.mdx @@ -30,7 +30,7 @@ Otherwise, edge tables behave like normal tables in terms of [updating](/docs/su ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" RELATE [ ONLY ] @from_record -> @table -> @to_record [ CONTENT @value | SET @field = @value ... diff --git a/src/content/doc-surrealql/statements/remove.mdx b/src/content/doc-surrealql/statements/remove.mdx index 848274483..716a8a4ef 100644 --- a/src/content/doc-surrealql/statements/remove.mdx +++ b/src/content/doc-surrealql/statements/remove.mdx @@ -13,7 +13,7 @@ Similar to an SQL DROP statement. ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" REMOVE [ NAMESPACE [ IF EXISTS ] @name | DATABASE [ IF EXISTS] @name diff --git a/src/content/doc-surrealql/statements/return.mdx b/src/content/doc-surrealql/statements/return.mdx index 2b1b85bd6..d44a6f8af 100644 --- a/src/content/doc-surrealql/statements/return.mdx +++ b/src/content/doc-surrealql/statements/return.mdx @@ -13,7 +13,7 @@ The `RETURN` statement can be used to return an implicit value or the result of ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" RETURN @value ``` diff --git a/src/content/doc-surrealql/statements/select.mdx b/src/content/doc-surrealql/statements/select.mdx index 5b0d42fd3..dd79bb0ed 100644 --- a/src/content/doc-surrealql/statements/select.mdx +++ b/src/content/doc-surrealql/statements/select.mdx @@ -15,7 +15,7 @@ In the [Learn more](#learn-more) section, you can find a video that explains how ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" SELECT [ VALUE ] @fields [ AS @alias ] [ OMIT @fields ...] FROM [ ONLY ] @targets diff --git a/src/content/doc-surrealql/statements/show.mdx b/src/content/doc-surrealql/statements/show.mdx index 06515cd4d..4ecaa01b8 100644 --- a/src/content/doc-surrealql/statements/show.mdx +++ b/src/content/doc-surrealql/statements/show.mdx @@ -14,7 +14,7 @@ The `SHOW` statement can be used to replay changes made to a table. ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" SHOW CHANGES FOR TABLE @tableName [ SINCE "@timestamp" ] [ LIMIT @number ] ``` @@ -87,4 +87,4 @@ Note the following when working with the versionstamps of a changefeed: Versionstamps carry the following two guarantees: * Versionstamps monotonically increase. -* Versionstamp format is universal across various backends. \ No newline at end of file +* Versionstamp format is universal across various backends. diff --git a/src/content/doc-surrealql/statements/sleep.mdx b/src/content/doc-surrealql/statements/sleep.mdx index 952b52ddd..b18a7c14c 100644 --- a/src/content/doc-surrealql/statements/sleep.mdx +++ b/src/content/doc-surrealql/statements/sleep.mdx @@ -11,7 +11,7 @@ The `SLEEP` statement is used to introduce a delay or pause in the execution of ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" SLEEP @duration; ``` @@ -34,4 +34,4 @@ For more dynamic usage of sleep, see SurrealDB's [sleep](/docs/surrealql/functio * Testing and debugging: can be used to understand how concurrent transactions interact, test how systems handle timeouts and delays, simulate behaviour in more distant regions with longer latency * Throttling: can be used to throttle the execution of operations to prevent the database from being overwhelmed by too many requests at once -* Security measures: can be used to slow down the response rate of login attempts to mitigate the risk of brute force attacks \ No newline at end of file +* Security measures: can be used to slow down the response rate of login attempts to mitigate the risk of brute force attacks diff --git a/src/content/doc-surrealql/statements/throw.mdx b/src/content/doc-surrealql/statements/throw.mdx index 9b14bedb0..4a88982cf 100644 --- a/src/content/doc-surrealql/statements/throw.mdx +++ b/src/content/doc-surrealql/statements/throw.mdx @@ -11,7 +11,7 @@ The `THROW` statement can be used to throw an error in a place where something u ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" THROW @error ``` @@ -83,4 +83,4 @@ SELECT * FROM account; id: account:two } ] -``` \ No newline at end of file +``` diff --git a/src/content/doc-surrealql/statements/update.mdx b/src/content/doc-surrealql/statements/update.mdx index 512e75e9d..45f8060dd 100644 --- a/src/content/doc-surrealql/statements/update.mdx +++ b/src/content/doc-surrealql/statements/update.mdx @@ -16,7 +16,7 @@ The `UPDATE` statement can be used to update existing records in the database. I ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" UPDATE [ ONLY ] @targets [ CONTENT @value | MERGE @value diff --git a/src/content/doc-surrealql/statements/upsert.mdx b/src/content/doc-surrealql/statements/upsert.mdx index d9178a93f..cf8c9bd30 100644 --- a/src/content/doc-surrealql/statements/upsert.mdx +++ b/src/content/doc-surrealql/statements/upsert.mdx @@ -17,7 +17,7 @@ This is different from the [`UPDATE`](/docs/surrealql/statements/update) stateme ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" UPSERT [ ONLY ] @targets [ CONTENT @value | MERGE @value diff --git a/src/content/doc-surrealql/statements/use.mdx b/src/content/doc-surrealql/statements/use.mdx index e18e7a062..b9f2ce48c 100644 --- a/src/content/doc-surrealql/statements/use.mdx +++ b/src/content/doc-surrealql/statements/use.mdx @@ -7,14 +7,14 @@ description: The USE statement specifies a namespace and / or a database to use # `USE` statement -The `USE` statement specifies a namespace and / or a database to use for the subsequent SurrealQL statements when switching between namespaces and databases. If you have a single namespace and database, you can define them in the [sql command](/docs/surrealdb/cli/sql#example-usage). +The `USE` statement specifies a namespace and / or a database to use for the subsequent SurrealQL statements when switching between namespaces and databases. If you have a single namespace and database, you can define them in the [sql command](/docs/surrealdb/cli/sql#example-usage). Ensure that your database and namespace exist and you have [started your database](/docs/surrealdb/cli/start) before using the Sql command option. ### Statement syntax -```surql title="SurrealQL Syntax" +```syntax title="SurrealQL Syntax" USE [ NS @ns ] [ DB @db ]; ```