taos_query/common/raw/views/
from.rs

1use crate::common::itypes::{INChar, IVarChar};
2
3use super::*;
4
5impl From<Vec<bool>> for ColumnView {
6    fn from(values: Vec<bool>) -> Self {
7        ColumnView::Bool(BoolView::from_iter(values))
8    }
9}
10
11impl From<Vec<Option<bool>>> for ColumnView {
12    fn from(values: Vec<Option<bool>>) -> Self {
13        ColumnView::Bool(BoolView::from_iter(values))
14    }
15}
16
17impl From<Vec<i8>> for ColumnView {
18    fn from(values: Vec<i8>) -> Self {
19        ColumnView::TinyInt(TinyIntView::from_iter(values))
20    }
21}
22
23impl From<Vec<Option<i8>>> for ColumnView {
24    fn from(values: Vec<Option<i8>>) -> Self {
25        ColumnView::TinyInt(TinyIntView::from_iter(values))
26    }
27}
28
29impl From<Vec<u8>> for ColumnView {
30    fn from(values: Vec<u8>) -> Self {
31        ColumnView::UTinyInt(UTinyIntView::from_iter(values))
32    }
33}
34
35impl From<Vec<Option<u8>>> for ColumnView {
36    fn from(values: Vec<Option<u8>>) -> Self {
37        ColumnView::UTinyInt(UTinyIntView::from_iter(values))
38    }
39}
40
41impl From<Vec<i16>> for ColumnView {
42    fn from(values: Vec<i16>) -> Self {
43        ColumnView::SmallInt(SmallIntView::from_iter(values))
44    }
45}
46
47impl From<Vec<Option<i16>>> for ColumnView {
48    fn from(values: Vec<Option<i16>>) -> Self {
49        ColumnView::SmallInt(SmallIntView::from_iter(values))
50    }
51}
52
53impl From<Vec<u16>> for ColumnView {
54    fn from(values: Vec<u16>) -> Self {
55        ColumnView::USmallInt(USmallIntView::from_iter(values))
56    }
57}
58
59impl From<Vec<Option<u16>>> for ColumnView {
60    fn from(values: Vec<Option<u16>>) -> Self {
61        ColumnView::USmallInt(USmallIntView::from_iter(values))
62    }
63}
64
65impl From<Vec<i32>> for ColumnView {
66    fn from(values: Vec<i32>) -> Self {
67        ColumnView::Int(IntView::from_iter(values))
68    }
69}
70
71impl From<Vec<Option<i32>>> for ColumnView {
72    fn from(values: Vec<Option<i32>>) -> Self {
73        ColumnView::Int(IntView::from_iter(values))
74    }
75}
76
77impl From<Vec<u32>> for ColumnView {
78    fn from(values: Vec<u32>) -> Self {
79        ColumnView::UInt(UIntView::from_iter(values))
80    }
81}
82
83impl From<Vec<Option<u32>>> for ColumnView {
84    fn from(values: Vec<Option<u32>>) -> Self {
85        ColumnView::UInt(UIntView::from_iter(values))
86    }
87}
88
89impl From<Vec<i64>> for ColumnView {
90    fn from(values: Vec<i64>) -> Self {
91        ColumnView::BigInt(BigIntView::from_iter(values))
92    }
93}
94
95impl From<Vec<Option<i64>>> for ColumnView {
96    fn from(values: Vec<Option<i64>>) -> Self {
97        ColumnView::BigInt(BigIntView::from_iter(values))
98    }
99}
100
101impl From<Vec<u64>> for ColumnView {
102    fn from(values: Vec<u64>) -> Self {
103        ColumnView::UBigInt(UBigIntView::from_iter(values))
104    }
105}
106
107impl From<Vec<Option<u64>>> for ColumnView {
108    fn from(values: Vec<Option<u64>>) -> Self {
109        ColumnView::UBigInt(UBigIntView::from_iter(values))
110    }
111}
112
113impl From<Vec<f32>> for ColumnView {
114    fn from(values: Vec<f32>) -> Self {
115        ColumnView::Float(FloatView::from_iter(values))
116    }
117}
118
119impl From<Vec<Option<f32>>> for ColumnView {
120    fn from(values: Vec<Option<f32>>) -> Self {
121        ColumnView::Float(FloatView::from_iter(values))
122    }
123}
124
125impl From<Vec<f64>> for ColumnView {
126    fn from(values: Vec<f64>) -> Self {
127        ColumnView::Double(DoubleView::from_iter(values))
128    }
129}
130
131impl From<Vec<Option<f64>>> for ColumnView {
132    fn from(values: Vec<Option<f64>>) -> Self {
133        ColumnView::Double(DoubleView::from_iter(values))
134    }
135}
136
137impl From<Vec<Option<IVarChar>>> for ColumnView {
138    fn from(values: Vec<Option<IVarChar>>) -> Self {
139        ColumnView::VarChar(VarCharView::from_iter::<IVarChar, _, _, _>(values))
140    }
141}
142
143impl From<Vec<Option<INChar>>> for ColumnView {
144    fn from(values: Vec<Option<INChar>>) -> Self {
145        ColumnView::NChar(NCharView::from_iter::<INChar, _, _, _>(values))
146    }
147}