Skip to content

Implemented equality for tsquery type - #3357

Merged
YohDeadfall merged 2 commits into
npgsql:mainfrom
YohDeadfall:ts-query-equatibility-and-tests
Nov 20, 2020
Merged

YohDeadfall merged 2 commits into
npgsql:mainfrom
YohDeadfall:ts-query-equatibility-and-tests

Conversation

@YohDeadfall

Copy link
Copy Markdown
Contributor

No description provided.

@YohDeadfall
YohDeadfall requested a review from roji as a code owner November 18, 2020 12:17
@YohDeadfall YohDeadfall added this to the vNext milestone Nov 18, 2020

@roji roji left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think each of the NpgsqlTsQuery subtypes should also implement IEquatable for themselves (e.g. NpgsqlTsQueryLexeme should implement IEquatable<NpgsqlTsQueryLexeme>)

Also, shouldn't we also do NpgsqlTsVector?

Comment thread src/Npgsql/Npgsql.csproj Resolved
@roji roji changed the title Implemented equatiblity for tsquery type Implemented equality for tsquery type Nov 20, 2020
@YohDeadfall

Copy link
Copy Markdown
Contributor Author

I think each of the NpgsqlTsQuery subtypes should also implement IEquatable

Will think, but for now I see no value in having it. What it will give?

Also, shouldn't we also do NpgsqlTsVector?

It's another story. Don't want to mix a lot of things in a single PR (this block better tests, plus types need more love than I gave them for now).

@YohDeadfall
YohDeadfall merged commit 112d96a into npgsql:main Nov 20, 2020
@YohDeadfall
YohDeadfall deleted the ts-query-equatibility-and-tests branch November 20, 2020 15:33
@roji

roji commented Nov 20, 2020

Copy link
Copy Markdown
Member

Will think, but for now I see no value in having it. What it will give?

IIRC, in various situations the type is checked whether it implemented IEquatable (against itself), and different behavior is chosen - I think that happens in Dictionary for example (and definitely in EF). So the fact that NpgsqlTsQueryLexeme implements IEquatable may be important e.g. in case it's used as a key.

@YohDeadfall

Copy link
Copy Markdown
Contributor Author

Using as a key something which just holds a string is weird. The same applies for other derived types.

@roji

roji commented Nov 21, 2020

Copy link
Copy Markdown
Member

Why is it weird... It allows for your dictionary to be strongly-typed only on these types. Who knows how exactly users are using our types.

Do you have any reason against adding these interface implementations?

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