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

Remove non public function definitions from DBAdapter type or create interface to require a close function for createCursor. #384

Open
lramirez925 opened this issue Jun 23, 2024 · 0 comments

Comments

@lramirez925
Copy link

Looking through the current implementation the DBAdapter createCursor function is never called by the service implementation which makes it feel like it is a private function that has leaked into the public interface.

Alternatively if this was created to allow for extended access to do more complicated queries/actions I can understand it being public. But then I feel it should have some kind of standardized return type. At minimum it should require close function to be part of the returned value so that actual cursor implementations are not left open. Those who don't return open connections can implement an empty close function. From what I have seen close is a pretty standard method for telling the object to no longer hold the connection/memory open.

Mongo package is one of those scenarios and the returned cursor appears to never gets close called on it once the values are retrieved from the MongoCursor object.

If the function is not meant to return a still open connection and the close is suppose to be done inside the cursor function can I suggest a name change? Cursors are normally understood to be a link to unretrieved data meaning the connection has remained open.

I only noticed this as I build my own adapter and I am having trouble understanding the uses for a lot of the "lower" functions as they seem to not be required by the DBService but still are publicly required to be on the DBAdapter implementation.

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

No branches or pull requests

1 participant