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 PgTsVector type and implement deserialization #44

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

encalypto
Copy link
Contributor

This commit introduces the PgTsVector, PgTsVectorEntry types. We also add an implementation of FromSql<TsVector, Pg> for PgTsVector for deserialization.

Two new tests were also added to check deserializing tsvectors with and without lexeme positions.

This commit introduces the `PgTsVector`, `PgTsVectorEntry` types. We
also add an implementation of `FromSql<TsVector, Pg> for PgTsVector` for
deserialization.

Two new tests were also added to check deserializing tsvectors with and
without lexeme positions.
Copy link
Member

@prkbuilds prkbuilds left a comment

Choose a reason for hiding this comment

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

Hi @encalypto , Thanks for the PR, the implementation looks correct. I just have one issue I wanted clarity on -

Will the lexeme text will always end with null terminator? If not I suggest handling the lexeme.pop() with some logic to check if it ends with null terminator.

@weiznich
Copy link
Member

Will the lexeme text will always end with null terminator? If not I suggest handling the lexeme.pop() with some logic to check if it ends with null terminator.

I think the format specifies that this is always the case. We nevertheless could still end up in a situation where this is not the case, for example if we get a truncated network package. I don't think we should care about these cases too much, as we would fail afterwards anyway.

Copy link
Member

@weiznich weiznich left a comment

Choose a reason for hiding this comment

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

Thanks for submitting this, looks good for me

@weiznich weiznich merged commit 963e15e into diesel-rs:master Nov 11, 2024
6 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.

3 participants