pub enum PostgresInsertValue<'a, V: SQLParam, T> {
Omit,
Null,
Value(ValueWrapper<'a, V, T>),
}Expand description
One column of a row in an INSERT: omitted, NULL, or a value or SQL expression.
Generated Insert* models store their fields as this type. T is the
column’s Rust type, used to check what can be assigned. Converting an
Option maps None to Omit, not to NULL.
Variants§
Omit
Leave the column out, so the database default applies.
Null
Insert NULL.
Value(ValueWrapper<'a, V, T>)
Insert a bound value, placeholder or SQL expression.
Implementations§
Source§impl<'a, T> PostgresInsertValue<'a, PostgresValue<'a>, T>
impl<'a, T> PostgresInsertValue<'a, PostgresValue<'a>, T>
Sourcepub fn into_owned(
self,
) -> PostgresInsertValue<'static, PostgresValue<'static>, T>
pub fn into_owned( self, ) -> PostgresInsertValue<'static, PostgresValue<'static>, T>
Converts to a 'static value that owns all its data.
The whole SQL fragment is kept: placeholders stay unbound and expressions keep their shape, with every bound value detached from its borrow.
Trait Implementations§
Source§impl<'a, V: SQLParam, T> Default for PostgresInsertValue<'a, V, T>
impl<'a, V: SQLParam, T> Default for PostgresInsertValue<'a, V, T>
Source§impl<'a> From<&str> for PostgresInsertValue<'a, PostgresValue<'a>, String>
impl<'a> From<&str> for PostgresInsertValue<'a, PostgresValue<'a>, String>
Source§impl<'a, T> From<Option<T>> for PostgresInsertValue<'a, PostgresValue<'a>, T>where
T: ToSQL<'a, PostgresValue<'a>>,
impl<'a, T> From<Option<T>> for PostgresInsertValue<'a, PostgresValue<'a>, T>where
T: ToSQL<'a, PostgresValue<'a>>,
Source§impl<'a, T> From<Placeholder> for PostgresInsertValue<'a, PostgresValue<'a>, T>
impl<'a, T> From<Placeholder> for PostgresInsertValue<'a, PostgresValue<'a>, T>
Source§fn from(placeholder: Placeholder) -> Self
fn from(placeholder: Placeholder) -> Self
Source§impl<'a, T> From<T> for PostgresInsertValue<'a, PostgresValue<'a>, T>where
T: TryInto<PostgresValue<'a>>,
Converts any value that converts to a PostgresValue (enums,
ArrayString, ArrayVec, …).
impl<'a, T> From<T> for PostgresInsertValue<'a, PostgresValue<'a>, T>where
T: TryInto<PostgresValue<'a>>,
Converts any value that converts to a PostgresValue (enums,
ArrayString, ArrayVec, …).
§Panics
Panics when the value fails to convert (a JSON payload that fails to serialize, for example), rather than storing NULL in its place.