walletkit_db/sqlite/
value.rs1#[derive(Debug, Clone, PartialEq, Eq)]
6pub enum Value {
7 Integer(i64),
9 Blob(Vec<u8>),
11 Text(String),
13 Null,
15}
16
17impl From<i64> for Value {
18 fn from(v: i64) -> Self {
19 Self::Integer(v)
20 }
21}
22
23impl From<Vec<u8>> for Value {
24 fn from(v: Vec<u8>) -> Self {
25 Self::Blob(v)
26 }
27}
28
29impl From<&[u8]> for Value {
30 fn from(v: &[u8]) -> Self {
31 Self::Blob(v.to_vec())
32 }
33}
34
35impl From<String> for Value {
36 fn from(v: String) -> Self {
37 Self::Text(v)
38 }
39}
40
41impl From<&str> for Value {
42 fn from(v: &str) -> Self {
43 Self::Text(v.to_string())
44 }
45}
46
47#[macro_export]
51macro_rules! params {
52 ($($val:expr),* $(,)?) => {
53 &[$($crate::Value::from($val)),*][..]
54 };
55}