drizzle_core/param/
owned.rs1use crate::{Param, Placeholder, SQLParam};
2
3#[derive(Debug, Clone)]
5pub struct OwnedParam<V: SQLParam> {
6 pub placeholder: Placeholder,
8 pub value: Option<V>,
10}
11
12impl<'a, V: SQLParam> From<Param<'a, V>> for OwnedParam<V> {
13 fn from(value: Param<'a, V>) -> Self {
14 Self {
15 placeholder: value.placeholder,
16 value: value.value.map(crate::prelude::Cow::into_owned),
17 }
18 }
19}
20
21impl<'a, V: SQLParam> From<&Param<'a, V>> for OwnedParam<V> {
22 fn from(value: &Param<'a, V>) -> Self {
23 Self {
24 placeholder: value.placeholder,
25 value: value.value.clone().map(crate::prelude::Cow::into_owned),
26 }
27 }
28}