123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- from abc import ABC, abstractmethod
- from models.area_email import AreaEmail
- from models.collect_data import CollectData
- from models.process_data import ProcessData
- from models.process_result_data import ProcessResultData
- class IDataStore(ABC):
- """
- 定义数据保存接口
- """
- @abstractmethod
- def query_one_collect_url(self, url: str) -> str | None:
- raise NotImplementedError("insert 应由子类重写。")
- @abstractmethod
- def insert_collect_data(self, data: CollectData, is_batch=True) -> None:
- raise NotImplementedError("insert 应由子类重写。")
- @abstractmethod
- def save_collect_data(self, is_force=False):
- raise NotImplementedError("save 应由子类重写。")
- @abstractmethod
- def set_collect_process(self, url):
- raise NotImplementedError("set_collect_process 应由子类重写。")
- @abstractmethod
- def query_urls_to_process(self):
- raise NotImplementedError("query_to_process 应由子类重写。")
- @abstractmethod
- def query_one_collect_by_url(self, url):
- raise NotImplementedError("query_one_collect_by_url 应由子类重写。")
- @abstractmethod
- def query_one_process_by_no(self, no):
- raise NotImplementedError("query_one_process_by_no 应由子类重写。")
- @abstractmethod
- def query_one_process_by_url(self, no):
- raise NotImplementedError("query_one_process_by_url 应由子类重写。")
- @abstractmethod
- def insert_process_data(self, data: ProcessData):
- raise NotImplementedError("insert_process_data 应由子类重写。")
- @abstractmethod
- def save_process_data(self, is_force=False):
- raise NotImplementedError("save_process_data 应由子类重写。")
- @abstractmethod
- def set_process_other_urls(self, url, other_urls: str):
- raise NotImplementedError("save_process_data 应由子类重写。")
- @abstractmethod
- def query_one_process_result_by_url(self, url):
- raise NotImplementedError("query_one_process_result_by_url 应由子类重写。")
- @abstractmethod
- def query_one_process_result_by_no(self, no):
- raise NotImplementedError("query_one_process_result_by_no 应由子类重写。")
- @abstractmethod
- def insert_process_result_data(self,
- data: ProcessResultData,
- is_batch=True):
- raise NotImplementedError("insert_process_result_data 应由子类重写。")
- @abstractmethod
- def save_process_result_data(self, is_force=False):
- raise NotImplementedError("save_process_result_data 应由子类重写。")
- @abstractmethod
- def set_process_result_other_urls(self, url, other_urls: str):
- raise NotImplementedError("set_process_result_other_urls 应由子类重写。")
- @abstractmethod
- def query_to_send(self):
- raise NotImplementedError("query_to_send 应由子类重写。")
- @abstractmethod
- def query_to_report_by_date(self, start_date, end_date):
- raise NotImplementedError("query_to_report_by_date 应由子类重写。")
- @abstractmethod
- def set_send(self, no: str):
- raise NotImplementedError("set_send 应由子类重写。")
- @abstractmethod
- def query_all_emails(self) -> list[AreaEmail]:
- raise NotImplementedError("get_emails 应由子类重写。")
- @abstractmethod
- def query_all_virtual_emails(self):
- raise NotImplementedError("get_email_by_area 应由子类重写。")
- @abstractmethod
- def query_master_email(self) -> str:
- raise NotImplementedError("get_master_email 应由子类重写。")
- @abstractmethod
- def get_email_by_area(self, area: str):
- raise NotImplementedError("get_email_by_area 应由子类重写。")
- @abstractmethod
- def update_area_email_area_by_name(self, name: str, area: str):
- raise NotImplementedError("update_area_email_area_by_name 应由子类重写。")
|