File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,20 @@ pub struct PgU128 {
1515 inner : BigDecimal ,
1616}
1717
18+ impl From < PgU128 > for u128 {
19+ fn from ( value : PgU128 ) -> Self {
20+ value. inner . to_string ( ) . parse ( ) . unwrap ( )
21+ }
22+ }
23+
24+ impl From < u128 > for PgU128 {
25+ fn from ( value : u128 ) -> Self {
26+ Self {
27+ inner : BigDecimal :: from ( value) ,
28+ }
29+ }
30+ }
31+
1832#[ cfg( test) ]
1933mod pg_u128_tests {
2034 use bigdecimal:: num_bigint:: BigInt ;
Original file line number Diff line number Diff line change @@ -15,6 +15,20 @@ pub struct PgU16 {
1515 inner : BigDecimal ,
1616}
1717
18+ impl From < PgU16 > for u16 {
19+ fn from ( value : PgU16 ) -> Self {
20+ value. inner . to_string ( ) . parse ( ) . unwrap ( )
21+ }
22+ }
23+
24+ impl From < u16 > for PgU16 {
25+ fn from ( value : u16 ) -> Self {
26+ Self {
27+ inner : BigDecimal :: from ( value) ,
28+ }
29+ }
30+ }
31+
1832#[ cfg( test) ]
1933mod pg_u16_tests {
2034 use bigdecimal:: num_bigint:: BigInt ;
Original file line number Diff line number Diff line change @@ -14,6 +14,20 @@ pub struct PgU32 {
1414 inner : BigDecimal ,
1515}
1616
17+ impl From < PgU32 > for u32 {
18+ fn from ( value : PgU32 ) -> Self {
19+ value. inner . to_string ( ) . parse ( ) . unwrap ( )
20+ }
21+ }
22+
23+ impl From < u32 > for PgU32 {
24+ fn from ( value : u32 ) -> Self {
25+ Self {
26+ inner : BigDecimal :: from ( value) ,
27+ }
28+ }
29+ }
30+
1731#[ cfg( test) ]
1832mod pg_u32_tests {
1933 use bigdecimal:: num_bigint:: BigInt ;
Original file line number Diff line number Diff line change @@ -14,6 +14,20 @@ pub struct PgU64 {
1414 inner : BigDecimal ,
1515}
1616
17+ impl From < PgU64 > for u64 {
18+ fn from ( value : PgU64 ) -> Self {
19+ value. inner . to_string ( ) . parse ( ) . unwrap ( )
20+ }
21+ }
22+
23+ impl From < u64 > for PgU64 {
24+ fn from ( value : u64 ) -> Self {
25+ Self {
26+ inner : BigDecimal :: from ( value) ,
27+ }
28+ }
29+ }
30+
1731#[ cfg( test) ]
1832mod pg_u64_tests {
1933 use bigdecimal:: num_bigint:: BigInt ;
Original file line number Diff line number Diff line change @@ -15,6 +15,20 @@ pub struct PgU8 {
1515 inner : BigDecimal ,
1616}
1717
18+ impl From < PgU8 > for u8 {
19+ fn from ( value : PgU8 ) -> Self {
20+ value. inner . to_string ( ) . parse ( ) . unwrap ( )
21+ }
22+ }
23+
24+ impl From < u8 > for PgU8 {
25+ fn from ( value : u8 ) -> Self {
26+ Self {
27+ inner : BigDecimal :: from ( value) ,
28+ }
29+ }
30+ }
31+
1832#[ cfg( test) ]
1933mod pg_u8_tests {
2034 use bigdecimal:: num_bigint:: BigInt ;
You can’t perform that action at this time.
0 commit comments