@@ -409,6 +409,27 @@ fn get_scalar_types(type_names: &Vec<TypeItem>, schema_name: String) -> database
409
409
_ => "any" ,
410
410
} ;
411
411
let type_name_scalar = ScalarTypeName :: new ( type_name. into ( ) ) ;
412
+ let type_rep = match type_item. name . as_str ( ) . to_lowercase ( ) . as_str ( ) {
413
+ "bool" | "boolean" => Some ( database:: TypeRepresentation :: Boolean ) ,
414
+ "int16" | "smallint" => Some ( database:: TypeRepresentation :: Int16 ) ,
415
+ "int" | "int32" | "integer" => Some ( database:: TypeRepresentation :: Int32 ) ,
416
+ "int64" | "bigint" => Some ( database:: TypeRepresentation :: Int64 ) ,
417
+ "numeric" => Some ( database:: TypeRepresentation :: BigDecimal ) ,
418
+ "float64" | "float" |"float8" => Some ( database:: TypeRepresentation :: Float64 ) ,
419
+ "real" | "float4" => Some ( database:: TypeRepresentation :: Float32 ) ,
420
+ "double precision" => Some ( database:: TypeRepresentation :: Float64 ) ,
421
+ "text" => Some ( database:: TypeRepresentation :: String ) ,
422
+ "string" => Some ( database:: TypeRepresentation :: String ) ,
423
+ "character" => Some ( database:: TypeRepresentation :: String ) ,
424
+ "json" | "jsonb" => Some ( database:: TypeRepresentation :: Json ) ,
425
+ "date" => Some ( database:: TypeRepresentation :: Date ) ,
426
+ "timetz" | "time with time zone" => Some ( database:: TypeRepresentation :: Timetz ) ,
427
+ "time" | "time without time zone" => Some ( database:: TypeRepresentation :: Time ) ,
428
+ "timestamptz" | "timestamp with time zone" => Some ( database:: TypeRepresentation :: Timestamptz ) ,
429
+ "timestamp" | "timestamp without time zone" => Some ( database:: TypeRepresentation :: Timestamp ) ,
430
+ "uuid" => Some ( database:: TypeRepresentation :: UUID ) ,
431
+ _ => None ,
432
+ } ;
412
433
scalar_types. insert (
413
434
type_name_scalar. clone ( ) ,
414
435
database:: ScalarType {
@@ -417,7 +438,7 @@ fn get_scalar_types(type_names: &Vec<TypeItem>, schema_name: String) -> database
417
438
comparison_operators : get_comparison_operators_for_type ( & type_name_scalar) ,
418
439
aggregate_functions : get_aggregate_functions_for_type ( & type_name_scalar) ,
419
440
description : None ,
420
- type_representation : None ,
441
+ type_representation : ( type_rep ) ,
421
442
} ,
422
443
// get_comparison_operators_for_type(&type_name.name),
423
444
) ;
0 commit comments