Skip to content

Attempt to bump to diesel 2.0#3

Open
qwattash wants to merge 9 commits into
lholden:masterfrom
qwattash:diesel-2.0
Open

Attempt to bump to diesel 2.0#3
qwattash wants to merge 9 commits into
lholden:masterfrom
qwattash:diesel-2.0

Conversation

@qwattash

Copy link
Copy Markdown
  • Add implementation for most hstore SQL operators and functions
  • Refactor testing to have multiple test functions

Suggestions and reviews are very welcome as I'm just getting started with Rust and probably not writing very rusty code.

Alfredo Mazzinghi added 8 commits March 7, 2023 15:51
This mainly involves the following:
 - Hstore now derive(SqlType) which removes the need to manually
 implement some traits.
 - We now have to implement trait Expression because it is no longer
 possible to use Bound in trait AsExpression.
 - LoadQuery requires trait QueryFragment
 - Minor fixes to respect trait signatures.
 - Minor fixes in tests and doctests.
Optionally derive Serialize and Deserialize for Hstore.
Use diesel test transactions to keep the database clean.
There are a few limitations to the current implementation:
 - Multi-dimensional arrays are not implemented, so the conversion
 to a (key, value) tuple array is not implemented.
 - The has_key, remove_key and get operators should be implemented
 as generics, but have not done so yet.
 - The replacement '#=' operator is not implemented.
Most functions are prefixed with hstore_ or otherwise renamed to avoid name
collisions.
Some functions are not implemented:
 - The populate_record and hstore(record) are not implemented
 - The json and tuple array conversion functions are not implemented
The dsl and functions implementations are conceptually independent, so split
them out.
The main hstore implementation is also separated.
@qwattash

Copy link
Copy Markdown
Author

Ideally, it would be nice to have something like a NullableHstore type to handle the case where hstore values are NULL, which is supported by postgres. Ignoring the entries may not be a good fit for all use cases, but by adding a NullableHstore type that rests on an HashMap<String, Option<String>> would allow to introduce this functionality without breaking the current API.

@Omicronlawful

Copy link
Copy Markdown

@qwattash why aren’t you merging it into diesel.rs instead of this dead repo?

@qwattash

Copy link
Copy Markdown
Author

@Omicronlawful I was under the impression that diesel.rs was choosing to support jsonb instead of hstore, but my impression is based on an old thread on the diesel issue tracker. I also do not own the code in this repo, if @lholden is fine with that I can try to upstream it properly, although I do not have much time on my hands right now.

@lholden

lholden commented Aug 10, 2023

Copy link
Copy Markdown
Owner

@qwattash You are welcome to use whatever code you want from this repo to do something upstream. :)

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.

3 participants