@@ -258,41 +258,41 @@ const PY_TYPE_MAP = {
258
258
// Miscellaneous types
259
259
void : 'None' ,
260
260
record : 'dict[str, Any]' ,
261
- } as const ;
261
+ } as const
262
262
263
- type PythonType = ( typeof PY_TYPE_MAP ) [ keyof typeof PY_TYPE_MAP ] ;
263
+ type PythonType = ( typeof PY_TYPE_MAP ) [ keyof typeof PY_TYPE_MAP ]
264
264
265
265
function pgTypeToPythonType ( pgType : string , nullable : boolean , types : PostgresType [ ] = [ ] ) : string {
266
- let pythonType : PythonType | undefined = undefined ;
266
+ let pythonType : PythonType | undefined = undefined
267
267
268
268
if ( pgType in PY_TYPE_MAP ) {
269
- pythonType = PY_TYPE_MAP [ pgType as keyof typeof PY_TYPE_MAP ] ;
269
+ pythonType = PY_TYPE_MAP [ pgType as keyof typeof PY_TYPE_MAP ]
270
270
}
271
271
272
272
// Enums
273
- const enumType = types . find ( ( type ) => type . name === pgType && type . enums . length > 0 ) ;
273
+ const enumType = types . find ( ( type ) => type . name === pgType && type . enums . length > 0 )
274
274
if ( enumType ) {
275
- pythonType = 'str' ; // Enums typically map to strings in Python
275
+ pythonType = 'str' // Enums typically map to strings in Python
276
276
}
277
277
278
278
if ( pythonType ) {
279
279
// If the type is nullable, append "| None" to the type
280
- return nullable ? `${ pythonType } | None` : pythonType ;
280
+ return nullable ? `${ pythonType } | None` : pythonType
281
281
}
282
282
283
283
// Composite types
284
- const compositeType = types . find ( ( type ) => type . name === pgType && type . attributes . length > 0 ) ;
284
+ const compositeType = types . find ( ( type ) => type . name === pgType && type . attributes . length > 0 )
285
285
if ( compositeType ) {
286
286
// In Python, we can map composite types to dictionaries
287
- return nullable ? 'dict[str, Any] | None' : 'dict[str, Any]' ;
287
+ return nullable ? 'dict[str, Any] | None' : 'dict[str, Any]'
288
288
}
289
289
290
290
// Arrays
291
291
if ( pgType . startsWith ( '_' ) ) {
292
- const innerType = pgTypeToPythonType ( pgType . slice ( 1 ) , nullable , types ) ;
293
- return `list[${ innerType } ]` ;
292
+ const innerType = pgTypeToPythonType ( pgType . slice ( 1 ) , nullable , types )
293
+ return `list[${ innerType } ]`
294
294
}
295
295
296
296
// Fallback
297
- return nullable ? 'Any | None' : 'Any' ;
297
+ return nullable ? 'Any | None' : 'Any'
298
298
}
0 commit comments