Is there a way to commit data inside a function in SurrealDB? It throws a syntax error if I place BEGIN TRANSACTION
within the {
and }
blocks:
There was a problem with the database: Parse error: Expected closing delimiter '}'
|
193 | BEGIN TRANSACTION;
| ^^^^^^^^^^^
|
192 | DEFINE FUNCTION fn::log($message: string) {
| ^ Expected this delimiter to close
I’ve also noticed that, if used within an event handler, the changes my function makes will be rolled-back if an exception is raised outside of my function call. I’m assuming this means that functions and event handlers disallow the use of BEGIN
and COMMIT
, but I am not sure why.