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

Storage get count #3684

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

Tigo-cmd
Copy link

@Tigo-cmd Tigo-cmd commented Aug 7, 2024

Update DBStorage and FileStorage, adding two new methods. All changes should be done in the branch storage_get_count:

A method to retrieve one object:

Prototype: def get(self, cls, id):
    cls: class
    id: string representing the object ID
Returns the object based on the class and its ID, or None if not found

A method to count the number of objects in storage:

Prototype: def count(self, cls=None):
    cls: class (optional)
Returns the number of objects in storage matching the given class. If no class is passed, returns the count of all objects in storage.

Don’t forget to add new tests for these 2 methods on each storage engine.

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.

1 participant