Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
CameronSima committed Sep 3, 2024
1 parent 1d4a236 commit cd6d1e0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,16 @@ Classes that inherit from `Service` are expected to have a property `name` attri
from zipline import ZipLine, Service

class LoggingService(Service):
def __init__(self):
self.name = "logger"
name = "logger"

def error(self, message):
print(f"Error! {message}")

class DBService(Service):
name = "db_service"

def __init__(self, logger: LoggingService):
self.name = "db_service"
self.logger = logger

def get_connection(self):
try:
Expand All @@ -139,8 +140,11 @@ class DBService(Service):
self.logger.error(e)

class UserService(Service):
name = "user_service"

def __init__(self, db_service: DBService, logger: LoggingService):
self.name = "user_service"
self.db_service = db_service
self.logger = logger

def get_user(id: str):
conn = self.db_service.get_connection()
Expand Down

0 comments on commit cd6d1e0

Please sign in to comment.