Skip to content

Conversation

addaleax
Copy link
Collaborator

chore(shell-api): combine common Cursor + AbstractCursor code

Create an AbstractCursor class (named like the driver equivalent)
as a common base class for Cursor and AggregationCursor
to reduce code duplication.

chore(shell-api): allow @returnType('this')

This helps with more code deduplication, because it can make wrappers
go away that were only needed to re-specify the return type
in a subclass.

}
},
},
AbstractCursor: {
Copy link
Collaborator

@mcasimir mcasimir Apr 27, 2021

Choose a reason for hiding this comment

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

Why is this necessary here? I don't think we want to make this class visible to the user in any way or?

Can we rather exclude this one with some annotation on the AbstractCursor class, something like @abstract or @nohelp?

Copy link
Collaborator

Choose a reason for hiding this comment

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

And of course i've tagged random users ... 🤦

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can we rather exclude this one with some annotation on the AbstractCursor class, something like @abstract or @nohelp?

Yes, let me try that (I think @gribnoysup’s #784 also has the potential to make this kind of thing much easier in the future)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mcasimir Okay, done :) Feel free to take another look

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, totally can take inheritance chains while ignoring those abstract classes into account when generating metadata

Copy link
Collaborator

@mcasimir mcasimir left a comment

Choose a reason for hiding this comment

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

nice!

Create an `AbstractCursor` class (named like the driver equivalent)
as a common base class for `Cursor` and `AggregationCursor`
to reduce code duplication.
This helps with more code deduplication, because it can make wrappers
go away that were only needed to re-specify the return type
in a subclass.
@addaleax addaleax merged commit 7f6f8c9 into master Apr 27, 2021
@addaleax addaleax deleted the dedupe-cursors branch April 27, 2021 13:46
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