Skip to content

Commit 1481304

Browse files
Logging added (#18)
* logging and tests added * minimal docs * clean up * Python 3.9 type compatibility * API Optimization (#19) * well... * remove class attributes * Succession Logs (#20)
1 parent f152d1b commit 1481304

File tree

9 files changed

+1160
-572
lines changed

9 files changed

+1160
-572
lines changed

README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ class ShelterRepository(AbstractRepository[Shelter]):
8484
"""Repository to manage shelters"""
8585
```
8686

87+
Optionally, you may pass a `logger` keyword argument to the repository to log the operations. The logger should be a `structlog` logger with enabled `JSONRenderer`. If no logger is provided the repository will use its default logger (`SQLModelRepositoryLogger`).
88+
8789
Done 🚀 You can now use the repository to perform the operations on your entities. e.g.:
8890

8991
```python
@@ -113,11 +115,7 @@ Each `Repository` comes with a set of **typed methods** to perform common CRUD o
113115

114116
______________________________________________________________________
115117

116-
- `find`: Find all records of an entity that match the given filters
117-
118-
______________________________________________________________________
119-
120-
- `get_by_id`: Get a single record by its ID
118+
- `get`: Get a single record by its ID
121119
- `get_batch`: Get all records of an entity that match the given filters
122120
- `get_batch_by_ids`: Get a batch of records by their IDs
123121
- `get_all`: Get all records of an entity
@@ -140,14 +138,15 @@ ______________________________________________________________________
140138

141139
If you require more flexibility, you may also use the `BaseRepository` which provides more granular operations. The `BaseRepository` provides the following methods:
142140

143-
- `_create`: Create a new record of an entity
144-
- `_create_batch`: Create a batch of records of an entity
145-
- `_update`: Update an entity instance
146-
- `_update_batch`: Update a batch of entity instances with the same values
147-
- `_get`: Get a single record by its ID
148-
- `_get_batch`: Get all records of an entity that match the given filters
149-
- `_delete`: Delete an entity instance
150-
- `_delete_batch`: Delete a batch of entity instances
141+
- `create`: Create a new record of an entity
142+
- `create_batch`: Create a batch of records of an entity
143+
- `update`: Update an entity instance
144+
- `update_batch`: Update a batch of entity instances with the same values
145+
- `get`: Get a single record by its ID
146+
- `get_batch`: Get all records of an entity that match the given filters
147+
- `find`: Find all records of an entity that match the given filters
148+
- `delete`: Delete an entity instance
149+
- `delete_batch`: Delete a batch of entity instances
151150

152151
## Examples
153152

0 commit comments

Comments
 (0)