-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make map/array encoding configurable #163
Make map/array encoding configurable #163
Conversation
Yea this looks great! |
lib/ecto/adapters/sqlite3.ex
Outdated
storage format. | ||
* `:array_type` - Defaults to `:string`. Determines the type of `:array` columns. | ||
Arrays are serialized using JSON. Set to `:binary` to use the | ||
[JSONB](https://sqlite.org/draft/jsonb.html) storage format. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JSONB](https://sqlite.org/draft/jsonb.html) storage format. | |
[JSONB](https://sqlite.org/jsonb.html) storage format. |
lib/ecto/adapters/sqlite3.ex
Outdated
@@ -51,6 +51,12 @@ defmodule Ecto.Adapters.SQLite3 do | |||
* `:uuid_type` - Defaults to `:string`. Determines the type of `:uuid` columns. | |||
Possible values and column types are the same as for | |||
[binary IDs](#module-binary-id-types). | |||
* `:map_type` - Defaults to `:string`. Determines the type of `:map` columns. | |||
Set to `:binary` to use the [JSONB](https://sqlite.org/draft/jsonb.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's point at the official docs and not the draft.
Set to `:binary` to use the [JSONB](https://sqlite.org/draft/jsonb.html) | |
Set to `:binary` to use the [JSONB](https://sqlite.org/jsonb.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops I missed that, fixed!
d21f7f4
to
ffeaeff
Compare
Closes #162
This PR adds:
:map_type
config option to determine how:map
columns are stored (:string
or:binary
):array_type
config option for:array
columns (also:string
or:binary
):array
columns are also serialized using JSONBoth default to
:string
, the:binary
option enables SQLite's JSONB storage format.I tried to be consistent with other configurable types in this project like
:uuid
that is why it is not implemented the exact same way as in the Postgres adapter.