The #[surrealism] attribute controls which Rust items are exported from your module and how SurrealDB should treat them.
Basic export
Use #[surrealism] on a function to expose it to SurrealQL:
After packaging and DEFINE MODULE, this function is callable through your module path.
writeable
Mark functions that perform writes with writeable:
This metadata is used by the query planner so read-only and write-capable functions can be scheduled with appropriate transaction modes.
comment = "..."
Attach human-readable metadata to an export:
The comment appears in module metadata outputs such as:
surreal module infoINFO FOR DB STRUCTUREmodule export metadata
init
Register one initialisation hook that runs once after module instantiation:
Use this for one-time setup such as preloading attached files or priming in-module caches.
Namespaced modules
Apply #[surrealism] to modules to group exports under namespaces:
Exports are prefixed by namespace, for example:
math::addmath::util::negate