Closed sbacarob closed 5 years ago
Hi @sbacarob thanks for contribution.
I will not merge this PR since I need to revert commit in tds lib that uses NaiveDateTime for datetime and datetime2 data types and leave old implementation with tuples. So loader/dumper will have different body implementation for :naive_datetime type. Reason is if TDS lib is gonna use NavieDateTime or other elixir builtin datetime types, then we will never have full precision of SQL server datetime2 that some apps may need. Also the addapter will offer custom types for Datetime2 and DaetTimeOffset for those apps that needs full precision.
Using this branch for MsSQL support, I got the following error triggered by
:naive_datetime
fields:Inspecting this pointed that the function
Ecto.Type.process_loaders/3
, which expects the second argument to be:error | {:ok, value}
, was instead receiving simplyvalue
for the second argument, causing it to fail.Thus, adding an extra matching clause in Ecto could also be a solution, but, since everything is being handled as
{:ok, value}
everywhere (including in thebool_decode
andjson_decode
functions), this solution seemed more appropriate