Table

SurrealDB table values represent table names and are returned as String values in the Java SDK. The Value class provides methods to check for and extract table values.

Checks if the value is a table name.

Method Syntax

value.isTable()

Returns: boolean

Returns the table name as a String.

Method Syntax

value.getTable()

Returns: String

Working with table values

import com.surrealdb.Surreal;
import com.surrealdb.Response;
import com.surrealdb.Value;
import com.surrealdb.signin.RootCredential;

try (Surreal db = new Surreal()) {
db.connect("ws://localhost:8000");
db.useNs("surrealdb").useDb("docs");
db.signin(new RootCredential("root", "root"));

Response response = db.query("RETURN <table> 'person'");
Value result = response.take(0);

if (result.isTable()) {
String tableName = result.getTable();
}
}

Was this page helpful?