Skip to content

Conversation

@a-nassim
Copy link
Contributor

Closes #162

This PR adds:

  1. :map_type config option to determine how :map columns are stored (:string or :binary)
  2. :array_type config option for :array columns (also :string or :binary)
    • I thought this would make sense since :array columns are also serialized using JSON

Both 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.

@warmwaffles
Copy link
Member

Yea this looks great!

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[JSONB](https://sqlite.org/draft/jsonb.html) storage format.
[JSONB](https://sqlite.org/jsonb.html) storage format.

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)
Copy link
Member

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.

Suggested change
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)

Copy link
Contributor Author

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!

@a-nassim a-nassim force-pushed the configurable-map-encoding branch from d21f7f4 to ffeaeff Compare March 19, 2025 02:19
@warmwaffles warmwaffles merged commit 952f38b into elixir-sqlite:main Mar 19, 2025
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make map encoding configurable

2 participants