• Start

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)

Argument

Description

fn_name

The function name, for example

fn::greet

or

time::now

.

args

The function arguments, each CBOR-encoded, as a

List[List[UInt8]]

.

session

An optional session id.

txn

An 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?