Skip to main content

RowExt

Trait RowExt 

Source
pub trait RowExt {
    // Required methods
    fn to_object(&self) -> Value;
    fn to_entries(&self) -> Vec<(String, Value)>;
}
Expand description

Converts a database row into JSON.

Required Methods§

Source

fn to_object(&self) -> Value

Converts this row’s columns to a JSON object.

Each column becomes a key in the returned object, with values converted to the most appropriate JSON type. NULL columns produce Value::Null.

Source

fn to_entries(&self) -> Vec<(String, Value)>

Converts this row’s columns to ordered (name, value) entries.

Keeps column order and duplicate names; values match Self::to_object.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<R> RowExt for R
where R: DecodeCell, usize: ColumnIndex<R>,