@@ -149,7 +149,9 @@ class ClickhouseConnector extends AdminForthBaseConnector implements IAdminForth
149149 return dayjs . unix ( + value ) . toISOString ( ) ;
150150 } else if ( field . _underlineType . startsWith ( 'DateTime' )
151151 || field . _underlineType . startsWith ( 'String' )
152- || field . _underlineType . startsWith ( 'FixedString' ) ) {
152+ || field . _underlineType . startsWith ( 'FixedString' )
153+ || field . _underlineType . startsWith ( 'Nullable(String)' )
154+ || field . _underlineType . startsWith ( 'Nullable(FixedString)' ) ) {
153155 const v = dayjs ( value ) . toISOString ( ) ;
154156 return v ;
155157 } else {
@@ -163,7 +165,10 @@ class ClickhouseConnector extends AdminForthBaseConnector implements IAdminForth
163165 } else if ( field . type == AdminForthDataTypes . BOOLEAN ) {
164166 return value === null ? null : ! ! value ;
165167 } else if ( field . type == AdminForthDataTypes . JSON ) {
166- if ( field . _underlineType . startsWith ( 'String' ) || field . _underlineType . startsWith ( 'FixedString' ) ) {
168+ if ( field . _underlineType . startsWith ( 'String' )
169+ || field . _underlineType . startsWith ( 'FixedString' )
170+ || field . _underlineType . startsWith ( 'Nullable(String)' )
171+ || field . _underlineType . startsWith ( 'Nullable(FixedString)' ) ) {
167172 try {
168173 return JSON . parse ( value ) ;
169174 } catch ( e ) {
@@ -186,7 +191,9 @@ class ClickhouseConnector extends AdminForthBaseConnector implements IAdminForth
186191 return dayjs ( value ) . unix ( ) ;
187192 } else if ( field . _underlineType . startsWith ( 'DateTime' )
188193 || field . _underlineType . startsWith ( 'String' )
189- || field . _underlineType . startsWith ( 'FixedString' ) ) {
194+ || field . _underlineType . startsWith ( 'FixedString' )
195+ || field . _underlineType . startsWith ( 'Nullable(String)' )
196+ || field . _underlineType . startsWith ( 'Nullable(FixedString)' ) ) {
190197 // value is iso string now, convert to unix timestamp
191198 const iso = dayjs ( value ) . format ( 'YYYY-MM-DDTHH:mm:ss' ) ;
192199 return iso ;
@@ -195,7 +202,10 @@ class ClickhouseConnector extends AdminForthBaseConnector implements IAdminForth
195202 return value === null ? null : ( value ? 1 : 0 ) ;
196203 } else if ( field . type == AdminForthDataTypes . JSON ) {
197204 // check underline type is text or string
198- if ( field . _underlineType . startsWith ( 'String' ) || field . _underlineType . startsWith ( 'FixedString' ) ) {
205+ if ( field . _underlineType . startsWith ( 'String' )
206+ || field . _underlineType . startsWith ( 'FixedString' )
207+ || field . _underlineType . startsWith ( 'Nullable(String)' )
208+ || field . _underlineType . startsWith ( 'Nullable(FixedString)' ) ) {
199209 return JSON . stringify ( value ) ;
200210 } else {
201211 afLogger . warn ( `AdminForth: JSON field is not a string/text but ${ field . _underlineType } , this is not supported yet` ) ;
0 commit comments