pub struct NativeResponse {
pub seq: u64,
pub status: ResponseStatus,
pub columns: Option<Vec<String>>,
pub rows: Option<Vec<Vec<Value>>>,
pub rows_affected: Option<u64>,
pub command: Option<String>,
pub watermark_lsn: u64,
pub error: Option<ErrorPayload>,
pub auth: Option<AuthResponse>,
pub warnings: Vec<String>,
}Expand description
A response sent from server to client over the native protocol.
Fields§
§seq: u64Echoed from the request for correlation.
status: ResponseStatusExecution outcome.
columns: Option<Vec<String>>Column names (for query results).
rows: Option<Vec<Vec<Value>>>Row data (for query results). Each row is a Vec of Values.
rows_affected: Option<u64>Number of rows affected (for writes).
command: Option<String>The statement’s command verb (INSERT, UPDATE, DELETE, UPSERT,
MERGE, TRUNCATE, …). None when the statement produced no DML
outcome.
watermark_lsn: u64WAL LSN watermark at time of computation.
error: Option<ErrorPayload>Error details (if status == Error).
auth: Option<AuthResponse>Auth response (if op == Auth and status == Ok).
warnings: Vec<String>Advisory warnings (e.g. password expiry grace period, must_change_password).
Empty in the common case; #[serde(default)] and #[msgpack(default)]
keep this additive and backward-compatible with older clients.
Implementations§
Source§impl NativeResponse
impl NativeResponse
Sourcepub fn from_query_result(seq: u64, qr: QueryResult, lsn: u64) -> Self
pub fn from_query_result(seq: u64, qr: QueryResult, lsn: u64) -> Self
Create a successful response from a QueryResult.
Sourcepub fn error(
seq: u64,
code: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn error( seq: u64, code: impl Into<String>, message: impl Into<String>, ) -> Self
Create an error response that carries only a SQLSTATE.
Use Self::error_with_code wherever the numeric NodeDB code is
known: a frame built here reaches the client with ndb_code == 0 and
collapses to a generic internal error on the far side.
Sourcepub fn error_with_code(
seq: u64,
code: impl Into<String>,
message: impl Into<String>,
ndb_code: u16,
) -> Self
pub fn error_with_code( seq: u64, code: impl Into<String>, message: impl Into<String>, ndb_code: u16, ) -> Self
Create an error response carrying both the SQLSTATE and the stable numeric NodeDB code, so the client can rebuild the typed error rather than inferring one from a many-to-one SQLSTATE.
Sourcepub fn with_error_details(self, details: ErrorDetails) -> Self
pub fn with_error_details(self, details: ErrorDetails) -> Self
Attach the structured error details to an error response. A response with no error payload is returned unchanged.
Sourcepub fn with_error_cause(self, cause: ErrorCausePayload) -> Self
pub fn with_error_cause(self, cause: ErrorCausePayload) -> Self
Attach the typed cause to an error response. A response with no error payload is returned unchanged.
Sourcepub fn auth_ok(seq: u64, username: String, tenant_id: u64) -> Self
pub fn auth_ok(seq: u64, username: String, tenant_id: u64) -> Self
Create an auth success response.
Sourcepub fn status_row(seq: u64, message: impl Into<String>) -> Self
pub fn status_row(seq: u64, message: impl Into<String>) -> Self
Create a response with a single “status” column and one row.
Trait Implementations§
Source§impl Clone for NativeResponse
impl Clone for NativeResponse
Source§impl Debug for NativeResponse
impl Debug for NativeResponse
Source§impl<'de> Deserialize<'de> for NativeResponse
impl<'de> Deserialize<'de> for NativeResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<'__msgpack_de> FromMessagePack<'__msgpack_de> for NativeResponse
impl<'__msgpack_de> FromMessagePack<'__msgpack_de> for NativeResponse
Source§impl Serialize for NativeResponse
impl Serialize for NativeResponse
Source§impl ToMessagePack for NativeResponse
impl ToMessagePack for NativeResponse
Source§fn write<W: Write>(&self, writer: &mut W) -> Result<(), Error>
fn write<W: Write>(&self, writer: &mut W) -> Result<(), Error>
Source§fn size_hint(&self) -> Option<TrustedSizeHint>
fn size_hint(&self) -> Option<TrustedSizeHint>
Self::write, or None when it cannot be determined cheaply. Read moreAuto Trait Implementations§
impl Freeze for NativeResponse
impl RefUnwindSafe for NativeResponse
impl Send for NativeResponse
impl Sync for NativeResponse
impl Unpin for NativeResponse
impl UnsafeUnpin for NativeResponse
impl UnwindSafe for NativeResponse
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> FromMessagePackOwned for Twhere
T: for<'a> FromMessagePack<'a>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.