You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Exqlite.TypeExtensions to allow more types to be stored in the database (#333)
Introduces a runtime extension to convert data types into something
that can be serialized into the database.
See elixir-sqlite/ecto_sqlite3#167 and
elixir-sqlite/ecto_sqlite3#166
My primary goal is to be able to use Spatialite from Elixir. With this
PR and the one against `ecto_sqlite3`, it is 95% of the way there. With
these two PRs applied, one can now do things like:
```elixir
defmodule Location do
use Ecto.Schema
schema "locations" do
field(:name, :string)
field(:geom, GeoSQL.Geometry)
end
end
MyApp.Repo.all(from(location in Location, select: MM2.distance(location.geom, ^geometry)))
```
.. and it just works, regardless of whether `MyApp.Repo` is point at a
PostgreSQL database with PostGIS enabled, or an SQLite3 database with
Spatialite loaded.
The one remaining annoyance is getting structs back *out* of the
database without going through ecto (which *does* work with the
`ecto_sqlite3` PR!). So, I still have to figure out a nice way for the
user to get back `Geo` structs from raw queries such as:
```
from(location in Location, limit: 1, select: MM2.transform(location.geom, 3452))
```
But otherwise everything Just Works transparently with this change.
0 commit comments