Further Surrealism examples
More examples of Surrealism in practice can be seen inside the surrealism repo. They include a more comprehensive demo of the Rust code, as well as a number of example commands that can be run on the command line.
Surrealism Rust code demo
This demo contains more examples of functions and the #[surrealism] attribute. For example, it can be used to rename the file on the SurrealDB side:
#[surrealism(name = "other")]
fn can_drive_bla(age: i64) -> bool {
age >= 18
}
It can be used to make a function the default, allowing it to be called via the module path alone:
#[surrealism(default)]
fn def(age: i64) -> bool {
age >= 18
}
CLI examples
This file shows further usage of how the CLI can be used to work with Surrealism functions directly as opposed to through a SurrealDB instance.
surreal module sig can_drive demo.surli
surreal module run can_drive --arg 17 demo.surli