@@ -35,7 +35,11 @@ function build_enum_name_w_module(str::String)
3535end
3636
3737function build_enum_value (str:: String )
38- StringCases. snakecase (str)
38+ # StringCases.snakecase returns a lowercase string, we need to uppercase the result if
39+ # the original string was in uppercase.
40+ # NOTE: Base.Unicode.isuppercase returns false on non-letter characters
41+ StringCases. snakecase (str) |>
42+ n -> all (c -> ! isletter (c) || Base. Unicode. isuppercase (c),str) ? uppercase (n) : n
3943end
4044
4145function build_struct_name (str:: String )
@@ -95,11 +99,17 @@ function is_vector_of_enum(coltype::String,
9599 customtypes_names)
96100end
97101
98- function get_fieldtype_from_coltype (coltype:: String ,
99- elttype:: String ,
100- customtypes:: Dict ,
101- ;tablename:: String = " " ,
102- colname:: String = " " )
102+ function get_fieldtype_from_coltype (
103+ coltype:: String ,
104+ elttype:: String ,
105+ customtypes:: Dict ,
106+ ;tablename:: String = " " ,
107+ colname:: String = " "
108+ )
109+
110+ if (colname == " duration" )
111+ @info " duration coltype[$coltype ]"
112+ end
103113
104114 attrtype = missing
105115 customtypes_names = keys (customtypes) |> collect |> n -> string .(n)
@@ -113,7 +123,7 @@ function get_fieldtype_from_coltype(coltype::String,
113123 attrtype = " Bool"
114124 elseif (coltype == " smallint" )
115125 attrtype = " Int16"
116- elseif (coltype == " integer" || coltype == " interval " )
126+ elseif (coltype == " integer" )
117127 attrtype = " Int32"
118128 elseif (coltype == " bigint" )
119129 attrtype = " Int64"
@@ -129,6 +139,8 @@ function get_fieldtype_from_coltype(coltype::String,
129139 attrtype = " DateTime"
130140 elseif (coltype == " timestamp with time zone" )
131141 attrtype = " ZonedDateTime"
142+ elseif coltype == " interval"
143+ attrtype = " Dates.CompoundPeriod"
132144 elseif (coltype == " ARRAY" )
133145 if (elttype == " _text" || elttype == " _varchar" )
134146 attrtype = " Vector{String}"
0 commit comments