• Start

Languages

/

Mojo

/

Methods

call

The call() method for the SurrealDB Mojo SDK runs a SurrealQL function.

Runs a SurrealQL function, built-in or custom, and returns its result.

Method Syntax

client.call(fn_name, args, session, txn)
ArgumentDescription
fn_nameThe function name, for example fn::greet or time::now.
argsThe function arguments, each CBOR-encoded, as a List[List[UInt8]].
sessionAn optional session id.
txnAn optional transaction id.
from surrealdb import CborCodec
from std.collections import List

var codec = CborCodec()
var args = List[List[UInt8]]()
args.append(codec.encode_text("Chiru"))

var resp = client.call("fn::greet", args)

Was this page helpful?