Query class

A received query on a queryable key expression.

Wraps a heap-allocated z_owned_query_t. The query holds a cloned reference to the original query from the callback. Call dispose when done to release native resources (even if no reply was sent).

This object holds a native handle, so it cannot cross an isolate boundary: a copy would share this one's native address while carrying its own fresh disposal flag, and the second release would be a use-after-free. Sending it throws ArgumentError naming the class.

No NativeFinalizer is attached to this class, deliberately: on the one-session path zd_query_drop POSTS to a Dart port, and a post reached from a finalizer callback is documented undefined behaviour. Measured: 1 post one-session, 0 over TCP loopback — the topology dependence is why "it worked once" is not evidence here. Releasing it explicitly is therefore the only thing that reclaims it.

Implemented types

Properties

acceptsReplies ReplyKeyExpr
Which key expressions this query accepts replies on (default matchingQuery).
final
attachmentBytes Uint8List?
The raw attachment bytes, or null if no attachment was present.
final
encoding String?
The encoding the requester declared, or null if none.
final
encodingBytes Uint8List?
The raw bytes of the rendered encoding, or null if the requester set none.
final
handle int
The native pointer handle for this query (used by reply methods).
no setter
hashCode int
The hash code for this object.
no setterinherited
keyExpr String
The key expression of this query.
final
parameters String
The query parameters — the selector's portion after ?.
final
payloadBytes Uint8List?
The optional payload attached to this query.
final
payloadZBytes ZBytes?
The query's payload as a retained ZBytes handle, or null if the requester sent none.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Releases the native query resources.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reply(Object keyExpr, String value, {Encoding? encoding, ZBytes? attachment, Timestamp? timestamp, bool? isExpress}) → void
Sends a reply to this query with a string value.
replyBytes(Object keyExpr, ZBytes payload, {Encoding? encoding, ZBytes? attachment, Timestamp? timestamp, bool? isExpress}) → void
Sends a reply to this query with a ZBytes payload.
replyDel(Object keyExpr, {ZBytes? attachment, Timestamp? timestamp, bool? isExpress}) → void
Sends a DELETE-kind reply to this query.
replyErr(String value, {Encoding? encoding}) → void
Sends an error reply to this query with a string value.
replyErrBytes(ZBytes payload, {Encoding? encoding}) → void
Sends an error reply to this query with a ZBytes payload.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited