# -*- encoding: utf-8 -*-
# -----------------------------------------------------------------------------
# @File Name  : base.py
# @Time       : 2020/11/18 下午12:47
# @Author     : X. Peng
# @Email      : acepengxiong@163.com
# @Software   : PyCharm
# -----------------------------------------------------------------------------
import datetime

from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()


class BaseModel():
    """."""

    def __init__(self):
        pass

    def to_dict(self):
        return {c.name: int(getattr(self, c.name).timestamp()) if isinstance(getattr(self, c.name), datetime.datetime) else getattr(self, c.name) for c in self.__table__.columns}


