File tree 2 files changed +11
-3
lines changed
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import "github.com/go-chi/chi"
10
10
import "github.com/jmoiron/sqlx"
11
11
12
12
type CounterDto struct {
13
- Counter * integer `json:"counter,omitempty" db:"counter"`
13
+ Counter * int `json:"counter,omitempty" db:"counter"`
14
14
}
15
15
16
16
type CategoryDto struct {
Original file line number Diff line number Diff line change @@ -70,12 +70,20 @@ function extractProperties(queryAst) {
70
70
return [];
71
71
}
72
72
73
+ function findOutType (fieldsInfo , fieldName ) {
74
+ const defaultType = ' *string' ;
75
+ const hasTypeInfo = fieldsInfo .hasOwnProperty (fieldName) && fieldsInfo[fieldName].hasOwnProperty (' type' );
76
+ if (hasTypeInfo && fieldsInfo[fieldName].type === ' integer' ) {
77
+ return ' *int' ;
78
+ }
79
+ return defaultType;
80
+ }
81
+
73
82
function addTypes (props , fieldsInfo ) {
74
83
return props .map (prop => {
75
- const hasTypeInfo = fieldsInfo .hasOwnProperty (prop) && fieldsInfo[prop].hasOwnProperty (' type' );
76
84
return {
77
85
" name" : prop,
78
- " type" : hasTypeInfo ? ' * ' + fieldsInfo[prop]. type : ' *string '
86
+ " type" : findOutType ( fieldsInfo, prop),
79
87
}
80
88
});
81
89
}
You can’t perform that action at this time.
0 commit comments