1+ #[ cfg( feature="with-serde" ) ] use serde:: { Serialize , Deserialize } ;
2+
13#[ derive( Clone , Debug , PartialEq ) ]
4+ #[ cfg_attr( feature = "with-serde" , derive( Serialize , Deserialize ) ) ]
25/// All built-in types of MySQL, excluding synonyms
36pub enum Type {
47 Serial ( NumericAttr ) ,
@@ -46,6 +49,7 @@ pub enum Type {
4649}
4750
4851#[ derive( Clone , Debug , Default , PartialEq ) ]
52+ #[ cfg_attr( feature = "with-serde" , derive( Serialize , Deserialize ) ) ]
4953pub struct NumericAttr {
5054 /// For integer types, M is the maximum display width (deprecated).
5155 /// For decimal types, M is the total number of digits.
@@ -59,35 +63,41 @@ pub struct NumericAttr {
5963}
6064
6165#[ derive( Clone , Debug , Default , PartialEq ) ]
66+ #[ cfg_attr( feature = "with-serde" , derive( Serialize , Deserialize ) ) ]
6267pub struct TimeAttr {
6368 pub fractional : Option < u32 > ,
6469}
6570
6671#[ derive( Clone , Debug , Default , PartialEq ) ]
72+ #[ cfg_attr( feature = "with-serde" , derive( Serialize , Deserialize ) ) ]
6773pub struct StringAttr {
6874 pub length : Option < u32 > ,
6975 pub charset_name : Option < String > ,
7076 pub collation_name : Option < String > ,
7177}
7278
7379#[ derive( Clone , Debug , Default , PartialEq ) ]
80+ #[ cfg_attr( feature = "with-serde" , derive( Serialize , Deserialize ) ) ]
7481pub struct BlobAttr {
7582 pub length : Option < u32 > ,
7683}
7784
7885#[ derive( Clone , Debug , Default , PartialEq ) ]
86+ #[ cfg_attr( feature = "with-serde" , derive( Serialize , Deserialize ) ) ]
7987pub struct EnumDef {
8088 pub values : Vec < String > ,
8189 pub attr : StringAttr ,
8290}
8391
8492#[ derive( Clone , Debug , Default , PartialEq ) ]
93+ #[ cfg_attr( feature = "with-serde" , derive( Serialize , Deserialize ) ) ]
8594pub struct SetDef {
8695 pub members : Vec < String > ,
8796 pub attr : StringAttr ,
8897}
8998
9099#[ derive( Clone , Debug , Default , PartialEq ) ]
100+ #[ cfg_attr( feature = "with-serde" , derive( Serialize , Deserialize ) ) ]
91101pub struct GeometryAttr {
92102 pub srid : Option < u32 > ,
93103}
0 commit comments