pub struct DbResultMessage {
pub msg_type: &'static str,
pub call_id: String,
pub op_id: Option<String>,
pub data: Option<Value>,
pub error: Option<ErrorInfo>,
}Expand description
Result of a DB operation, sent back to TypeScript.
op_id is echoed from the incoming DbOpMessage.op_id when present.
The TS runtime uses it to demux concurrent DB ops inside a single
function call (e.g. Promise.all([ctx.db.get(a), ctx.db.get(b)])).
Absent op_id keeps legacy TS runtimes compatible.
Fields§
§msg_type: &'static str§call_id: String§op_id: Option<String>§data: Option<Value>§error: Option<ErrorInfo>Implementations§
Source§impl DbResultMessage
impl DbResultMessage
pub fn ok(call_id: String, data: Value) -> Self
pub fn ok_with_op(call_id: String, op_id: Option<String>, data: Value) -> Self
pub fn err(call_id: String, code: &str, message: &str) -> Self
pub fn err_with_op( call_id: String, op_id: Option<String>, code: &str, message: &str, ) -> Self
Trait Implementations§
Source§impl Clone for DbResultMessage
impl Clone for DbResultMessage
Source§fn clone(&self) -> DbResultMessage
fn clone(&self) -> DbResultMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DbResultMessage
impl Debug for DbResultMessage
Auto Trait Implementations§
impl Freeze for DbResultMessage
impl RefUnwindSafe for DbResultMessage
impl Send for DbResultMessage
impl Sync for DbResultMessage
impl Unpin for DbResultMessage
impl UnsafeUnpin for DbResultMessage
impl UnwindSafe for DbResultMessage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more