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

Make sqlite value function public #4480

Conversation

weiznich
Copy link
Member

This commit turns the read_* functions of the SqliteValue type into public functions, which makes it easier for third party crates to access the underlying sqlite values in a performant way. This enables crates to not clone for example the string, but rather reuse the string slice we got from sqlite instead.

This also turns all these functions into methods that require a mutable reference instead of a shared reference as technically each of those methods might mutate the underlying value according to the sqlite documentation.

@weiznich weiznich requested a review from a team February 11, 2025 18:59
@weiznich weiznich force-pushed the feature/public_read_functions_for_sqlite_value branch from bb9638f to 33ed970 Compare February 11, 2025 19:01
This commit turns the `read_*` functions of the `SqliteValue` type into
public functions, which makes it easier for third party crates to access
the underlying sqlite values in a performant way. This enables crates to
not clone for example the string, but rather reuse the string slice we got
from sqlite instead.

This also turns all these functions into methods that require a mutable
reference instead of a shared reference as technically each of those
methods might mutate the underlying value according to the sqlite
documentation.
@weiznich weiznich force-pushed the feature/public_read_functions_for_sqlite_value branch from 33ed970 to c1688e3 Compare February 11, 2025 19:15
use crate::sql_types::{Blob, Double, Int4, Text};
use crate::*;

#[expect(clippy::approx_constant)] // we really want to use 3.14
Copy link
Member

Choose a reason for hiding this comment

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

🤣

@weiznich weiznich added this pull request to the merge queue Feb 14, 2025
Merged via the queue into diesel-rs:master with commit 07b97ef Feb 14, 2025
34 checks passed
weiznich added a commit to weiznich/diesel that referenced this pull request Feb 14, 2025
This commit prepares a 2.2.8 release that includes the following
changes:

* diesel-rs#4472
* diesel-rs#4484
* diesel-rs#4486
* diesel-rs#4480
weiznich added a commit to weiznich/diesel that referenced this pull request Feb 14, 2025
This commit prepares a 2.2.8 release that includes the following
changes:

* diesel-rs#4472
* diesel-rs#4484
* diesel-rs#4486
* diesel-rs#4480
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