assembly_fdb_core/value/
owned.rs1use super::{Context, Value};
4
5#[derive(Debug, PartialEq, Eq)]
7pub struct OwnedContext;
8
9impl Context for OwnedContext {
10 type String = String;
11 type I64 = i64;
12 type XML = String;
13}
14
15pub type Field = Value<OwnedContext>;
17
18#[cfg(feature = "sqlite")]
19use rusqlite::types::ToSqlOutput;
20#[cfg(feature = "sqlite")]
21impl rusqlite::ToSql for Field {
22 fn to_sql(&self) -> rusqlite::Result<rusqlite::types::ToSqlOutput<'_>> {
23 Ok(match self {
24 Field::Nothing => ToSqlOutput::Owned(rusqlite::types::Value::Null),
25 Field::Integer(i) => (*i).into(),
26 Field::Float(f) => (*f).into(),
27 Field::Boolean(b) => (*b).into(),
28 Field::BigInt(i) => (*i).into(),
29 Field::Text(s) => s.as_str().into(),
30 Field::VarChar(s) => s.as_str().into(),
31 })
32 }
33}