Skip to main content

JsonColumnValue

Trait JsonColumnValue 

Source
pub trait JsonColumnValue<T>: Sized {
    // Required method
    fn from_json(value: Json<T>) -> Self;
}
Available on crate feature serde only.
Expand description

A model field value that can hold a JSON payload.

Dialect crates implement this for their insert and update value types. Table macros call it to convert the payload type of a JSON field.

Required Methods§

Source

fn from_json(value: Json<T>) -> Self

Converts value into the SQL value of a JSON column.

§Panics

Panics when T’s Serialize implementation fails, because the model setters that call this have no error channel; see Json.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<'a, T, Target, TargetNull> JsonColumnValue<T> for MySQLUpdateValue<'a, MySQLValue<'a>, T, Target, TargetNull>
where T: Serialize, Target: DataType, TargetNull: Nullability,

Source§

impl<'a, T, Target, TargetNull> JsonColumnValue<T> for PostgresUpdateValue<'a, PostgresValue<'a>, T, Target, TargetNull>
where T: Serialize, Target: PostgresJsonType, TargetNull: Nullability,

The column’s SQL type marker (Target) selects json or jsonb.

Source§

impl<'a, T, Target, TargetNull> JsonColumnValue<T> for SQLiteUpdateValue<'a, SQLiteValue<'a>, T, Target, TargetNull>
where T: Serialize, Target: DataType, TargetNull: Nullability,

Source§

impl<'a, T> JsonColumnValue<T> for MySQLInsertValue<'a, MySQLValue<'a>, T>
where T: Serialize,

Source§

impl<'a, T> JsonColumnValue<T> for SQLiteInsertValue<'a, SQLiteValue<'a>, T>
where T: Serialize,