File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed
adminforth/dataConnectors Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ class ClickhouseConnector extends AdminForthBaseConnector implements IAdminForth
107
107
}
108
108
return dayjs ( value ) . toISOString ( ) . split ( 'T' ) [ 0 ] ;
109
109
} else if ( field . type == AdminForthDataTypes . BOOLEAN ) {
110
- return ! ! value ;
110
+ return value === null ? null : ! ! value ;
111
111
} else if ( field . type == AdminForthDataTypes . JSON ) {
112
112
if ( field . _underlineType . startsWith ( 'String' ) || field . _underlineType . startsWith ( 'FixedString' ) ) {
113
113
try {
@@ -138,7 +138,7 @@ class ClickhouseConnector extends AdminForthBaseConnector implements IAdminForth
138
138
return iso ;
139
139
}
140
140
} else if ( field . type == AdminForthDataTypes . BOOLEAN ) {
141
- return value ? 1 : 0 ;
141
+ return value === null ? null : ( value ? 1 : 0 ) ;
142
142
} else if ( field . type == AdminForthDataTypes . JSON ) {
143
143
// check underline type is text or string
144
144
if ( field . _underlineType . startsWith ( 'String' ) || field . _underlineType . startsWith ( 'FixedString' ) ) {
Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ class MysqlConnector extends AdminForthBaseConnector implements IAdminForthDataS
130
130
} else if ( field . type == AdminForthDataTypes . TIME ) {
131
131
return value || null ;
132
132
} else if ( field . type == AdminForthDataTypes . BOOLEAN ) {
133
- return ! ! value ;
133
+ return value === null ? null : ! ! value ;
134
134
} else if ( field . type == AdminForthDataTypes . JSON ) {
135
135
if ( typeof value === 'string' ) {
136
136
try {
@@ -158,7 +158,7 @@ class MysqlConnector extends AdminForthBaseConnector implements IAdminForthDataS
158
158
}
159
159
return dayjs ( value ) . format ( 'YYYY-MM-DD HH:mm:ss' ) ;
160
160
} else if ( field . type == AdminForthDataTypes . BOOLEAN ) {
161
- return value ? 1 : 0 ;
161
+ return value === null ? null : ( value ? 1 : 0 ) ;
162
162
} else if ( field . type == AdminForthDataTypes . JSON ) {
163
163
if ( field . _underlineType === 'json' ) {
164
164
return value ;
Original file line number Diff line number Diff line change @@ -157,6 +157,10 @@ class PostgresConnector extends AdminForthBaseConnector implements IAdminForthDa
157
157
return dayjs ( value ) . toISOString ( ) . split ( 'T' ) [ 0 ] ;
158
158
}
159
159
160
+ if ( field . type == AdminForthDataTypes . BOOLEAN ) {
161
+ return value === null ? null : ! ! value ;
162
+ }
163
+
160
164
if ( field . type == AdminForthDataTypes . JSON ) {
161
165
if ( typeof value == 'string' ) {
162
166
try {
@@ -188,7 +192,7 @@ class PostgresConnector extends AdminForthBaseConnector implements IAdminForthDa
188
192
return dayjs ( value ) . toISOString ( ) ;
189
193
}
190
194
} else if ( field . type == AdminForthDataTypes . BOOLEAN ) {
191
- return value ? 1 : 0 ;
195
+ return value === null ? null : ( value ? 1 : 0 ) ;
192
196
} else if ( field . type == AdminForthDataTypes . JSON ) {
193
197
if ( field . _underlineType == 'json' ) {
194
198
return value ;
You can’t perform that action at this time.
0 commit comments