File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed
my-postgres-tests/src/dto Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 11/target
22** /.idea
33** /Cargo.lock
4- ** /target
4+ ** /target
5+ .vscode
Original file line number Diff line number Diff line change @@ -16,9 +16,9 @@ impl<'s> WhereFields<'s> {
1616 let mut offset = None ;
1717 let mut other_fields = Vec :: new ( ) ;
1818 for struct_prop in src_fields. get_fields ( ) {
19- if struct_prop. attrs . has_attr ( "limit" ) {
19+ if struct_prop. attrs . has_attr ( "limit" ) || ( struct_prop . name == "limit" && struct_prop . ty . is_usize ( ) ) {
2020 limit = Some ( struct_prop) ;
21- } else if struct_prop. attrs . has_attr ( "offset" ) {
21+ } else if struct_prop. attrs . has_attr ( "offset" ) || ( struct_prop . name == "offset" && struct_prop . ty . is_usize ( ) ) {
2222 offset = Some ( struct_prop) ;
2323 } else {
2424 other_fields. push ( struct_prop) ;
Original file line number Diff line number Diff line change @@ -5,6 +5,9 @@ pub struct WhereRawModel {
55 pub field_1 : String ,
66 pub field_2 : bool ,
77 pub field_3 : Vec < i32 > ,
8+
9+ pub limit : usize ,
10+ pub offset : usize ,
811}
912
1013#[ cfg( test) ]
@@ -19,6 +22,8 @@ mod tests {
1922 field_1 : "test" . to_string ( ) ,
2023 field_2 : true ,
2124 field_3 : vec ! [ 1 , 2 , 3 ] ,
25+ limit : 10 ,
26+ offset : 5 ,
2227 } ;
2328
2429 let mut params = my_postgres:: sql:: SqlValues :: new ( ) ;
@@ -38,6 +43,8 @@ mod tests {
3843 field_1 : "test" . to_string ( ) ,
3944 field_2 : true ,
4045 field_3 : vec ! [ ] ,
46+ limit : 10 ,
47+ offset : 5 ,
4148 } ;
4249
4350 let mut params = my_postgres:: sql:: SqlValues :: new ( ) ;
@@ -54,6 +61,8 @@ mod tests {
5461 field_1 : "test" . to_string ( ) ,
5562 field_2 : true ,
5663 field_3 : vec ! [ 1 ] ,
64+ limit : 10 ,
65+ offset : 5 ,
5766 } ;
5867
5968 let mut params = my_postgres:: sql:: SqlValues :: new ( ) ;
You can’t perform that action at this time.
0 commit comments