Skip to main content

doc_url_for_function

Function doc_url_for_function 

Source
pub fn doc_url_for_function(name: &str) -> Option<&'static str>
Expand description

Get the documentation URL for a SurrealQL function by its full qualified name.

Matches namespaced functions like "string::len" or "array::push" to their namespace documentation page (e.g., the String functions page).

Also matches standalone functions like "count", "not", "sleep", "rand".

ยงExamples

use surql_parser::doc_urls::doc_url_for_function;

assert_eq!(
    doc_url_for_function("string::len"),
    Some("https://surrealdb.com/docs/surrealql/functions/database/string"),
);
assert_eq!(
    doc_url_for_function("array::push"),
    Some("https://surrealdb.com/docs/surrealql/functions/database/array"),
);
assert_eq!(
    doc_url_for_function("count"),
    Some("https://surrealdb.com/docs/surrealql/functions/database/count"),
);
assert_eq!(doc_url_for_function("unknown::thing"), None);