1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use tipb::FieldType;
use crate::FieldTypeAccessor;
#[derive(Default)]
pub struct FieldTypeBuilder(FieldType);
impl FieldTypeBuilder {
pub fn new() -> Self {
Default::default()
}
pub fn tp(mut self, v: crate::FieldTypeTp) -> Self {
FieldTypeAccessor::set_tp(&mut self.0, v);
self
}
pub fn flag(mut self, v: crate::FieldTypeFlag) -> Self {
FieldTypeAccessor::set_flag(&mut self.0, v);
self
}
pub fn flen(mut self, v: isize) -> Self {
FieldTypeAccessor::set_flen(&mut self.0, v);
self
}
pub fn decimal(mut self, v: isize) -> Self {
FieldTypeAccessor::set_decimal(&mut self.0, v);
self
}
pub fn collation(mut self, v: crate::Collation) -> Self {
FieldTypeAccessor::set_collation(&mut self.0, v);
self
}
pub fn build(self) -> FieldType {
self.0
}
}
impl From<FieldTypeBuilder> for FieldType {
fn from(fp_builder: FieldTypeBuilder) -> FieldType {
fp_builder.build()
}
}