Skip to content
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

Add support for bstr::BString and git2::Oid, behind feature flags #839

Merged
merged 4 commits into from
Dec 19, 2020

Conversation

joshtriplett
Copy link
Contributor

This adds support for SQL conversions for the bstr::BString binary
string type, and for the git2::Oid object ID type. Both types are
encoded and decoded as bytes.

These types are database-independent and work with any database that can
handle bytes, so add tests that work with sqlite.

This allows queries to convert between BString and SQL data types.
This allows queries to convert between Oid and SQL data types.
@joshtriplett
Copy link
Contributor Author

With this, Decode seems to work, but Encode doesn't compile when used with either BString or Oid. I think the bound on Encode needs to be something like &'q [u8]: ... rather than [u8]: ....

@mehcode mehcode merged commit 603c195 into launchbadge:master Dec 19, 2020
@mehcode
Copy link
Member

mehcode commented Dec 19, 2020

Thanks! Got the impls merged and working. Only weirdness is I had to change the test because:

sqlite> SELECT 'abc123' is cast('abc123' as blob);
0
sqlite> SELECT  cast('abc123' as blob);
abc123
sqlite> SELECT cast('abc123' as blob) is cast('abc123' as blob);
1

@joshtriplett
Copy link
Contributor Author

@mehcode Much appreciated, thank you! I look forward to using these impls once the next release comes out.

@joshtriplett joshtriplett deleted the types branch December 19, 2020 06:14
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.

2 participants