API Reference
Auto-generated from docstrings. Every exported symbol is listed below.
Connection
SurrealDB.connect — Function
connect(url::String; ns=nothing, db=nothing, token=nothing, auth=nothing)
connect(f::Function, url::String; kwargs...)Connect to a SurrealDB instance. The URL scheme determines the backend:
| URL scheme | Backend | Description |
|---|---|---|
ws://host:port | Remote WS | WebSocket (stateful) |
http://host:port | Remote HTTP | HTTP (stateless) |
mem:// | Embedded | In-memory database |
surrealkv://path | Embedded | File-backed database |
Keyword arguments:
ns,db: Namespace and database to select after connectingtoken: JWT token for authenticationauth: Auth struct (RootAuth,NamespaceAuth, etc.) for signinreconnect::Bool=true: Auto-reconnect on socket drop (WS only)reconnect_max_attempts::Int=10: Consecutive failures before giving upreconnect_base_delay::Float64=0.5: Initial backoff (exponential, in seconds)reconnect_max_delay::Float64=30.0: Cap on the backoff delayreconnect_jitter::Float64=0.1: Random jitter factor [0,1] applied to each backoffping_interval::Float64=30.0: Keepalive cadence;0disablestls_verify::Bool=true: Verify TLS certs onwss://. Setfalseonly for self-signed test certsrpc_timeout::Float64=30.0: Max seconds to wait for an RPC response;Infdisables
Returns a SurrealClient{C} where C is the concrete connection backend type.
Do-block form
The function form mirrors Base.open: the client is closed automatically on exit, even if the block throws.
SurrealDB.connect("ws://localhost:8000"; ns="test", db="test") do db
SurrealDB.query(db, "SELECT * FROM stream")
end # client is closed hereSurrealDB.close! — Function
close!(client::SurrealClient)Close the database connection. The client cannot be used after this call.
SurrealDB.status — Function
status(client::SurrealClient)Return the current connection status as a Symbol: :connected, :disconnected, :connecting, :reconnecting
SurrealDB.events — Function
events(client::SurrealClient{<:AbstractRemoteConnection}) -> Channel{Symbol}Return a Channel that emits lifecycle event symbols on remote-connection state transitions: :connecting, :connected, :reconnecting, :disconnected. Drop-in equivalent of the JS SDK's db.subscribe('connected', ...) pattern. Best-effort emission — if no consumer drains the channel, events are queued (capacity 64) and dropped silently when the buffer is full.
Only RemoteConnection emits events today; embedded connections have a much simpler lifecycle (connect succeeds or throws) so the Channel exists but is never written to.
Examples
db = SurrealDB.connect("ws://localhost:8000")
@async for ev in SurrealDB.events(db)
@info "SurrealDB lifecycle" event=ev status=SurrealDB.status(db)
endSurrealDB.SurrealClient — Type
SurrealClient{C<:AbstractConnection}The main client type for interacting with a SurrealDB database.
Generic over the connection backend type C. Create via connect.
Examples
db = SurrealDB.connect("ws://localhost:8000")
SurrealDB.use!(db, "test", "test")
result = SurrealDB.query(db, "SELECT * FROM stream")SurrealDB.AbstractConnection — Type
AbstractConnectionAbstract base type for SurrealDB connection backends. Concrete implementations: RemoteWSConnection, RemoteHTTPConnection (both <: AbstractRemoteConnection), and EmbeddedConnection (in SurrealDB.Embedded).
SurrealDB.RemoteConnection — Type
RemoteConnection(url)A remote connection to a SurrealDB server via WebSocket or HTTP.
URL schemes accepted:
ws://host:port/wss://host:port— WebSocket (primary, stateful)http://host:port/https://host:port— HTTP (stateless)
SurrealDB.RemoteWSConnection — Type
RemoteConnection(url)A remote connection to a SurrealDB server via WebSocket or HTTP.
URL schemes accepted:
ws://host:port/wss://host:port— WebSocket (primary, stateful)http://host:port/https://host:port— HTTP (stateless)
SurrealDB.RemoteHTTPConnection — Type
RemoteConnection(url)A remote connection to a SurrealDB server via WebSocket or HTTP.
URL schemes accepted:
ws://host:port/wss://host:port— WebSocket (primary, stateful)http://host:port/https://host:port— HTTP (stateless)
SurrealDB.Embedded.EmbeddedConnection — Type
EmbeddedConnection(url)An embedded SurrealDB connection running in-process via libsurreal.
URL schemes:
mem://ormemory://— in-memory database (no persistence)surrealkv://path/to/data.skv— file-backed database
Requires libsurreal to be loaded via libsurreal_load!.
Authentication
SurrealDB.signin! — Function
signin!(client, auth) -> token::StringAuthenticate with the SurrealDB server.
auth can be:
RootAuth- root-level credentialsNamespaceAuth- namespace-level credentialsScopedAuth- record-level credentials via an access methodDict{String, Any}- raw parameters (e.g., for bearer keys, refresh tokens)
Returns the JWT token string on success. The SDK stores the token on the client so subsequent RPCs are authenticated automatically; the token is also replayed on reconnect.
Examples
token = SurrealDB.signin!(db, SurrealDB.RootAuth("root", "password"))
token = SurrealDB.signin!(db, SurrealDB.NamespaceAuth("ns", "db", "user", "pass"))
token = SurrealDB.signin!(db, SurrealDB.ScopedAuth("ns", "db", "access", "user", "pass"))
token = SurrealDB.signin!(db, Dict("NS" => "ns", "DB" => "db", "AC" => "access",
"user" => "u", "pass" => "p"))SurrealDB.signup! — Function
signup!(client, auth::ScopedAuth)Register a new user via a RECORD-scope access method.
Returns the JWT token string on success.
Note: SurrealDB signup is only available with RECORD-scoped access methods.
SurrealDB.authenticate! — Function
authenticate!(client, token::String)Authenticate the current connection with a pre-obtained JWT token.
This is useful when you have a JWT from a previous signin or an external auth system.
Examples
SurrealDB.authenticate!(db, "eyJ0eXAiOiJKV1QiLCJh...")SurrealDB.invalidate! — Function
invalidate!(client)Clear the current authentication session. Subsequent operations will be unauthenticated.
SurrealDB.RootAuth — Type
RootAuth(username, password)Root-level authentication credentials.
SurrealDB.NamespaceAuth — Type
NamespaceAuth(namespace, database, username, password)Namespace-level authentication credentials.
SurrealDB.ScopedAuth — Type
ScopedAuth(namespace, database, access, username, password)
ScopedAuth(namespace, database, access, params::AbstractDict)Scoped authentication credentials (record-level auth via an access method).
The 5-arg form is the convenience case for SIGNIN clauses that reference $user / $pass. The dict form passes through arbitrary keys for SIGNIN clauses referencing other params ($email, $name, etc.).
SurrealDB.signin!(db, SurrealDB.ScopedAuth("ns", "db", "user_access", "alice", "hunter2"))
SurrealDB.signin!(db, SurrealDB.ScopedAuth("ns", "db", "user_access",
Dict("email" => "a@example.com",
"pass" => "hunter2")))SurrealDB.JwtAuth — Type
JwtAuth(token)JWT token-based authentication. Use with authenticate!.
Database scope
SurrealDB.use! — Function
use!(client::SurrealClient, ns::String, db::String)Select a namespace and database for all subsequent operations.
SurrealDB.info — Function
info(client::SurrealClient)Retrieve database-level information such as tables and schema.
Returns a Dict{String, Any}.
SurrealDB.version — Function
version(client::SurrealClient)Retrieve the SurrealDB server version.
Returns a NamedTuple with fields :version, :build, :timestamp.
SurrealDB.health — Function
health(client::SurrealClient)Check the health of the database connection.
Returns true if the database is healthy.
Query and CRUD
SurrealDB.query — Function
query(client, sql::String; vars=Dict{String, Any}())Execute a raw SurrealQL query with optional parameterized variables.
Returns Vector{Dict{String, Any}} — one result dict per statement.
Examples
result = SurrealDB.query(db, "SELECT * FROM stream WHERE active = true")
result = SurrealDB.query(db, "SELECT * FROM $table WHERE x > $min",
vars=Dict("table" => "stream", "min" => 10))query(client, ::Type{T}, sql::String; vars=Dict{String, Any}())Execute a raw SurrealQL query and map results to typed Julia structs.
T must be a type for which StructTypes.StructType(T) returns StructTypes.Struct(). Each result row is converted to an instance of T via StructTypes.constructfrom.
Returns Vector{T} — one instance per result row.
Examples
struct Stream
id::SurrealDB.RecordID
name::String
mature::Bool
end
StructTypes.StructType(::Type{Stream}) = StructTypes.Struct()
streams = SurrealDB.query(db, Stream, "SELECT * FROM stream")SurrealDB.query_table — Function
query_table(client, sql::String; vars=Dict{String, Any}()) -> Vector{QueryResultTable}Like query but returns one QueryResultTable per statement instead of nested vectors. Lets multi-statement queries preserve their per-statement structure as Tables.jl-compatible sources.
Remote (WS/HTTP) preserves per-statement results. Embedded (libsurreal) flattens all rows from all statements into a single result list (the C library does not expose statement boundaries). On embedded, query_table therefore returns a single-element Vector regardless of how many ;s the SQL contains. Run multi-statement queries one at a time on embedded if you need per-statement separation.
Examples
tables = SurrealDB.query_table(db, "SELECT * FROM stream; SELECT * FROM event")
using DataFrames
streams_df = DataFrame(tables[1])
events_df = DataFrame(tables[2])SurrealDB.query_one — Function
query_one(client, sql::String; vars=Dict{String, Any}()) -> QueryResultTableConvenience wrapper around query_table for single-statement queries. Asserts the SQL produced exactly one statement-result and returns its QueryResultTable. Throws ArgumentError if the query produced zero or multiple statements.
Examples
table = SurrealDB.query_one(db, "SELECT * FROM stream WHERE active = true")
using DataFrames
df = DataFrame(table)See also: query, query_table.
SurrealDB.create — Function
create(client, what, data::Dict{String, Any})Create a new record in the table or with a specific ID.
Returns the created record(s) as a Dict or Vector of Dicts.
create(client, ::Type{T}, what, data)Create a record and return it as a typed struct T.
Examples
stream = SurrealDB.create(db, Stream, "stream", Dict("name" => "new"))SurrealDB.select — Function
select(client, what) -> AnySelect all records from a table or fetch a specific record by ID.
Returns a Vector of records when what is a table, or a single record (Dict) when what is a record ID. Returns an empty vector / nothing when the target does not exist.
select(client, ::Type{T}, what)Select a record or table and map results to typed Julia struct T.
For table selects, returns Vector{T}. For record selects, returns T.
Examples
struct Stream
id::SurrealDB.RecordID
name::String
end
StructTypes.StructType(::Type{Stream}) = StructTypes.Struct()
all_streams = SurrealDB.select(db, Stream, "stream")
one_stream = SurrealDB.select(db, Stream, "stream:abc")SurrealDB.update — Function
update(client, what, data) -> AnyReplace the contents of a record (or every record in a table) with data. Existing fields not present in data are removed; for partial updates use merge instead.
what: Table name or record IDdata: Replacement record contents (Dict)
Returns the updated record(s).
SurrealDB.delete — Function
delete(client, what) -> AnyDelete a record or every record in a table.
what: Table name or record ID
Returns the deleted record(s). Deleting a nonexistent record is not an error on SurrealDB v3 (returns nothing).
SurrealDB.insert — Function
insert(client, table, data) -> AnyInsert one or many records into a table. Unlike create, data may be a single Dict or a Vector of Dicts for batch inserts; ids are auto-assigned when not provided.
table: Table name (String orTable)data: Single Dict or Vector of Dicts
Returns the inserted record(s).
See also: create, insert_relation.
SurrealDB.upsert — Function
upsert(client, what, data) -> AnyCreate the record if it does not exist, otherwise replace it. Same payload shape as update; the difference is that update on a missing record may not create it on all SurrealDB versions.
SurrealDB.merge — Function
merge(client, what, data) -> AnyPartially update a record by merging data into the existing record. Fields present in data overwrite existing fields; fields absent are preserved (unlike update which replaces the whole record).
what: Table name or record IDdata: Partial record contents (Dict)
SurrealDB.relate — Function
relate(client, from, edge, to; data=nothing) -> Any
relate(client, rel::Relationship) -> AnyCreate a graph edge from from to to via edge. The flat-arg form is the canonical first-class signature; the Relationship form is convenient for storing/passing pre-built edges.
from: source record id (RecordIDor"table:id"string)edge: edge table (Tableor String) or specific edge record idto: target record iddata: optional Dict of edge fields
Returns the created edge record.
Examples
SurrealDB.relate(db, "person:john", "knows", "person:jane";
data=Dict("met" => "2024-01-01"))
# Or via the bulk struct
rel = Relationship("person:john", Table("knows"), "person:jane",
Dict("met" => "2024-01-01"))
SurrealDB.relate(db, rel)See also: insert_relation, Relationship.
SurrealDB.insert_relation — Function
insert_relation(client, relationship::Relationship) -> AnyInsert a graph edge defined by a Relationship. Equivalent to SurrealQL INSERT RELATION INTO <table> { in, out, ... }.
Differs from relate in that insert_relation is intended for batch / seeded edges; relate is the canonical first-class edge primitive.
See also: relate, Relationship.
SurrealDB.patch — Function
patch(client, what, patches::Vector{Dict{String, Any}})Apply JSON Patch operations to a record.
Examples
SurrealDB.patch(db, "user:1", [
Dict("op" => "replace", "path" => "/name", "value" => "New Name"),
Dict("op" => "add", "path" => "/tags/0", "value" => "new-tag")
])SurrealDB.patch_add — Function
patch_add(client, what, path::String, value)Convenience wrapper around patch that issues a single JSON-Patch add operation at path. what is a table name, Table, or RecordID.
SurrealDB.patch_remove — Function
patch_remove(client, what, path::String)Convenience wrapper around patch that issues a single JSON-Patch remove operation at path.
SurrealDB.patch_replace — Function
patch_replace(client, what, path::String, value)Convenience wrapper around patch that issues a single JSON-Patch replace operation at path.
SurrealDB.run — Function
run(client, fn_name::String, args=Any[]; version=nothing) -> AnyInvoke a SurrealDB function — builtin (type::*, string::*, ...) or user-defined (fn::*).
fn_name: Function name including namespace, e.g."fn::greet"or"type::is::array"args: Positional args as aVectorversion: Optional semver string for versioned user functions
Examples
SurrealDB.run(db, "type::is::array", [[1, 2, 3]]) # → true
SurrealDB.run(db, "fn::greet", ["world"])SurrealDB.ping — Function
ping(client::SurrealClient) -> BoolSend a lightweight RPC ping. Returns true if the server responds. Backs the keepalive timer; exposed for callers who want a manual liveness check without health()'s trivial-query fallback.
SurrealDB.let! — Function
let!(client, key::String, value)Set a session variable. These variables can be referenced in SurrealQL queries using $key syntax.
Examples
SurrealDB.let!(db, "min_age", 18)
result = SurrealDB.query(db, "SELECT * FROM user WHERE age > $min_age")SurrealDB.unset! — Function
unset!(client, key::String)Remove a previously set session variable.
Live queries
SurrealDB.live — Function
live(client, table; diff=false)Start a live query subscription on a table.
Returns a LiveSubscription with a channel field you can iterate over to receive real-time notifications.
table: Table name (String orTable)diff: Iftrue, notifications include the diff between old and new values
Examples
sub = SurrealDB.live(db, "stream")
for notification in sub.channel
println("Action: ", notification["action"])
println("Data: ", notification["data"])
break # or loop forever
end
SurrealDB.kill!(sub)SurrealDB.kill! — Function
kill!(client, query_id::String)Terminate a live query by its UUID. If a LiveSubscription handle was registered for this id (i.e. created via live), its active flag is flipped to false and its channel is closed so consumers iterating it observe the termination.
kill!(sub::LiveSubscription)Terminate a live query subscription. Delegates to kill! by id, which flips sub.active and closes the channel.
SurrealDB.LiveSubscription — Type
LiveSubscription(query_id, channel, client)A live query subscription. Iterate over sub.channel (or sub directly) to receive LiveNotification events. Call kill!(sub) to terminate.
Fields:
query_id::String: UUID string identifying the live query on the serverchannel::Channel: receivesLiveNotificationeventsactive::Bool: subscription state
SurrealDB.LiveNotification — Type
LiveNotification(action, query_id, record, result, session)One live-query event delivered to a LiveSubscription channel. Subtype of AbstractDict{String, Any} so legacy n["action"] access keeps working alongside the typed n.action form.
Fields:
action::String:"CREATE","UPDATE", or"DELETE"("KILLED"events are dropped by the dispatcher)query_id::String: live UUID matchingsub.query_idrecord::Union{String, Nothing}: affected record id, e.g."users:abc"result::Any: payload — the record on CREATE/UPDATE, the pre-delete record on DELETEsession::Union{String, Nothing}: v3 session id;nothingon v2
Transactions and sessions
SurrealDB.begin! — Function
begin!(client)Start a new transaction. All subsequent operations within the transaction are isolated until commit! or cancel! is called.
On SurrealDB v3+ remote connections, begin!/commit!/cancel! RPC methods may return "Expected transaction UUID". Use raw SurrealQL instead:
SurrealDB.query(db, "BEGIN TRANSACTION; ...; COMMIT TRANSACTION;")begin!(session::SurrealSession)Start a transaction within a v3+ session.
Returns the transaction UUID. Pass this to commit! or cancel!.
SurrealDB.commit! — Function
commit!(client)Commit the active transaction, persisting all changes made within it. For v3+ remote connections, prefer raw SurrealQL COMMIT TRANSACTION;.
commit!(session::SurrealSession, txn_id)Commit a transaction within a v3+ session.
SurrealDB.cancel! — Function
cancel!(client)Cancel / rollback the active transaction, discarding all changes made within it. For v3+ remote connections, prefer raw SurrealQL CANCEL TRANSACTION;.
cancel!(session::SurrealSession, txn_id)Cancel/rollback a transaction within a v3+ session.
SurrealDB.attach! — Function
attach!(client)Create a new ephemeral session on the server (SurrealDB v3+).
Returns a UUID session identifier. The session is independent — it has its own namespace, database, auth, and variables. Use detach! to clean up.
WebSocket-only (not supported on HTTP connections).
SurrealDB.detach! — Function
detach!(client, session_id::UUID)Destroy a server-side session (SurrealDB v3+).
After detaching, the session cannot be used for further operations.
SurrealDB.sessions — Function
sessions(client)List active session UUIDs on the server (SurrealDB v3+).
Returns Vector{UUID}.
SurrealDB.SurrealSession — Type
SurrealSessionA v3+ server-side session wrapping a SurrealClient.
Fields:
client::SurrealClient— the underlying connectionsession_id::UUID— the server-assigned session identifier
All operations on this session are scoped to the session's namespace, database, auth, and variables.
Import / Export
SurrealDB.export_db — Function
export_db(client::SurrealClient, filepath::String)Export the current namespace and database to a file.
SurrealDB.import_db — Function
import_db(client::SurrealClient, filepath::String)Import data from a file into the current namespace and database.
Embedded mode
SurrealDB.Embedded.libsurreal_load! — Function
libsurreal_load!(path::String="")Load the libsurreal shared library at path for embedded mode. When path is empty, falls back to the SURREALDB_LIB environment variable.
Must be called before connect("mem://") or connect("surrealkv://..."). Remote connections (ws://, http://) don't need this.
Examples
SurrealDB.libsurreal_load!("/path/to/libsurrealdb_c.dylib")
db = SurrealDB.connect("mem://")Tables.jl and graph extensions
SurrealDB.to_table — Function
to_table(results) -> QueryResultTableConvert query results to a Tables.jl-compatible source. Can be passed directly to DataFrame() from DataFrames.jl, Tables.columntable, etc.
results can be:
- A
Vector{Dict{String, Any}}(single-statement result rows) - A
Vector{Any}containing nested vectors of dicts (multi-statement; rows are flattened across all statements) - A single
Dict(treated as a one-row table)
SurrealDB.to_metagraph — Function
to_metagraph(vertices, edges; ...)
to_metagraph(client::SurrealClient, vertices_query::String, edges_query::String; ...)Materialize query results into a MetaGraphsNext.MetaGraph (with vertex labels = record-id strings, vertex/edge data = field Dicts). Method bodies live in the SurrealDBMetaGraphsNextExt Pkg extension, loaded automatically by Julia 1.9+ when the user has MetaGraphsNext and Graphs in their environment.
If the extension isn't loaded, calls throw a clear error pointing the user at the right install command.
SurrealDB.QueryResultTable — Type
QueryResultTableA Tables.jl-compatible wrapper around query results. Stores rows as a Vector{Dict{String, Any}} and delegates Tables.jl operations to Tables.dictrowtable / Tables.dictcolumntable so columns are derived lazily on access (no eager materialization). Use to_table to construct from raw query results.
Examples
result = SurrealDB.query(db, "SELECT * FROM stream")
table = SurrealDB.to_table(result)
using DataFrames
df = DataFrame(table) # column-major access
for row in Tables.rows(table) # row-major iteration
println(row)
endCore types
SurrealDB.RecordID — Type
RecordID(table, id)Represents a SurrealDB record identifier consisting of a table name and an ID.
Examples
RecordID("user", "abc123") # table + string id
RecordID("user", 42) # table + integer id
RecordID("user:abc123") # parse from stringSurrealDB.Table — Type
Table(name)Represents a SurrealDB table name. Wraps a String for clarity in the API.
Examples
Table("stream")SurrealDB.SurrealValue — Type
SurrealValue(kind::SurrealValueKind, value)A tagged union representing any SurrealDB value type. Used internally for precision type handling when mapping to/from C FFI types in embedded mode.
Most users never construct one directly — query / select / etc. handle the conversions automatically.
SurrealDB.Relationship — Type
Relationship(in, relation, out; data=Dict())Represents a graph relationship between two records.
Examples
rel = Relationship("person:john", Table("knows"), "person:jane",
data=Dict("met" => "2024-01-01"))Errors
SurrealDB.SurrealDBError — Type
SurrealDBErrorAbstract base type for all SurrealDB SDK errors.
SurrealDB.ServerError — Type
ServerError <: SurrealDBErrorAbstract supertype for errors that originated server-side (i.e. the SurrealDB engine reported the failure). Mirrors the kind-tagged ServerError hierarchy in surrealdb.js and surrealdb.py — concrete subtypes correspond to the kind field of the wire-protocol error payload.
Concrete subtypes:
ValidationError— request validation failedConfigurationError— database/namespace/feature misconfigurationThrownError— userTHROWstatementQueryError— SurrealQL parse/execution failureSerializationError— wire encode/decode failureNotAllowedError— auth/permission denialNotFoundError— record/table/namespace not foundAlreadyExistsError— record already existsInternalError— server-side bug
Catch ServerError to handle any server-side failure uniformly; catch a specific subtype for kind-aware handling.
SurrealDB.RPCError — Type
RPCError(code, message)Represents a JSON-RPC error returned by the SurrealDB server. This includes transport errors, protocol errors, and server-side failures.
Fields:
code::Int: JSON-RPC numeric error codemessage::String: Human-readable error message from the server
SurrealDB.QueryError — Type
QueryError(message)A SurrealQL parse or execution failure. Subtype of ServerError.
Fields:
message::String: Error message describing the query failureis_timed_out::Bool:truewhen the server reports the query timed outis_cancelled::Bool:truewhen the query was cancelled mid-execution
Bare-message constructor is supported for backward compat: QueryError(msg) ≡ QueryError(msg, false, false).
SurrealDB.ValidationError — Type
ValidationError(message; parameter_name=nothing, is_parse_error=false)Request validation failed before the query was executed. Subtype of ServerError.
SurrealDB.ConfigurationError — Type
ConfigurationError(message; is_live_query_not_supported=false)Database/namespace/feature configuration prevents the operation. Subtype of ServerError.
SurrealDB.ThrownError — Type
ThrownError(message)Result of an explicit user THROW statement in SurrealQL. Subtype of ServerError.
SurrealDB.SerializationError — Type
SerializationError(message; is_deserialization=false)Wire-format encode/decode failure. Subtype of ServerError.
SurrealDB.NotAllowedError — Type
NotAllowedError(message; is_token_expired=false, is_invalid_auth=false, method_name=nothing)Authentication or authorization denied the request. Subtype of ServerError.
SurrealDB.NotFoundError — Type
NotFoundError(message; table_name=nothing, record_id=nothing, namespace_name=nothing)A referenced record, table, or namespace does not exist. Subtype of ServerError.
SurrealDB.AlreadyExistsError — Type
AlreadyExistsError(message; table_name=nothing, record_id=nothing)The target record/table already exists and the operation rejects duplicates. Subtype of ServerError.
SurrealDB.InternalError — Type
InternalError(message)A server-side bug or unexpected condition. Subtype of ServerError.
SurrealDB.ConnectionError — Type
ConnectionError(message, cause)Represents a connection-level failure (WebSocket disconnect, timeout, etc.).
Fields:
message::String: Description of the connection failurecause::Union{Exception, Nothing}: Underlying exception that caused the failure, if any
SurrealDB.ConnectionUnavailableError — Type
ConnectionUnavailableError(message="No active connection to the database.")The client is not connected (or has been closed). Distinct from ConnectionError which represents transport-level failures during an attempt; this is raised for "no connection at all" scenarios.
SurrealDB.UnsupportedEngineError — Type
UnsupportedEngineError(scheme::String)The URL scheme is not recognised. Mirrors the JS SDK's same-named error.
SurrealDB.UnsupportedFeatureError — Type
UnsupportedFeatureError(feature, transport=nothing)The requested operation is not supported on the current transport (e.g. live queries over HTTP). feature is a Symbol naming the feature; transport optionally names the transport that lacks support.
SurrealDB.UnexpectedResponseError — Type
UnexpectedResponseError(message)The server returned a response in an unexpected shape. Used when the wire format doesn't match any of the documented response variants.
SurrealDB.EmbeddedFFIError — Type
EmbeddedFFIError(op, message)A failure originating from the embedded libsurreal FFI layer. Distinct from RPCError (which represents server-side JSON-RPC failures) and ConnectionError (transport-level failures) so callers can distinguish "libsurreal misbehaved" from "the network blinked."
Fields:
op::String: the FFI operation that failed (e.g."sr_patch_add","_self_test_layout")message::String: error message — either propagated from the C library or describing the layout/lookup mismatch