Open bosonbaas opened 3 years ago
Like you said, using multiple dispatch is more flexible than using a Dict{Type,Symbol}
since you can do stuff like:
sql_type(::Type{<:Real}) = :Real
sql_type(::Type{<:Integer}) = :Int
Another complication is that different SQL DBs have very different data types, e.g. compare SQLite's minimalist data types to all the Postgres data types.
That would be an indication that we should make an sql_type(::Type{PGSQLConverter}, t::T)
or sql_type(::Type{SQLiteConverter}, t::T)
function so that multiple backends can be added later.
Currently, the conversion from Julia Types to SQL types is just facilitated by a dictionary between types. While a solution other than hardcoding the type conversion would be preferable (maybe a more popular library that already maintains this map?), taking advantage of the Julia multiple dispatch system will make it a more flexible hardcoding.