AirBnB_clone_v2 icon indicating copy to clipboard operation
AirBnB_clone_v2 copied to clipboard

method get() & count() were added to file_storage and db_storage

Open santiagobedoa opened this issue 2 years ago • 0 comments

DBStorage and FileStorage updated.

Two new methods were added to both files:

  1. A method to retrieve one object:

    • Prototype: def get(self, cls, id)
    • cls: class
    • id: string representing the object ID
    • RETURN: object based on the class and its ID, or None if not found.
  2. A method to count the number of objects in storage:

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

New tests were added for these 2 methods on each storage engine.

santiagobedoa avatar Sep 16 '22 03:09 santiagobedoa