pub struct Column { /* private fields */ }Expand description
Metadata about a column in a result set.
Column carries the three pieces of information the wire protocol’s
RowDescription message provides for each result field: the column
name, its type OID, and the type modifier that encodes width-specific
parameters like NUMERIC(precision, scale) or VARCHAR(n).
The type modifier is essential for decoding types whose wire format
depends on declared precision/scale (e.g. NUMERIC, where precision
≤ 18 uses an 8-byte i64 wire form and precision > 18 uses a
16-byte i128 wire form — and in both cases the scale needed to
interpret the unscaled integer value lives only in the type
modifier). Upper layers construct a SqlType from OID + modifier
via crate::types::SqlType::from_oid_and_modifier — using
crate::types::SqlType::from_oid alone silently drops precision
and scale, causing decoders to default to scale = 0 and corrupt
fractional values.
Implementations§
Source§impl Column
impl Column
Sourcepub fn type_modifier(&self) -> i32
pub fn type_modifier(&self) -> i32
Returns the column’s type modifier (PostgreSQL-style atttypmod).
For NUMERIC columns this encodes precision and scale and is
required for correct decode (see
crate::types::SqlType::from_oid_and_modifier). For most other
types the server sends -1 to indicate “no modifier”.
Sourcepub fn format(&self) -> ColumnFormat
pub fn format(&self) -> ColumnFormat
Returns the data format for this column.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Column
impl RefUnwindSafe for Column
impl Send for Column
impl Sync for Column
impl Unpin for Column
impl UnsafeUnpin for Column
impl UnwindSafe for Column
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request