from sqlalchemy import Column, Integer, String
from utils.rdbmsUtil.modelBase import Base
from utils.rdbmsUtil.factoryRegistry import FactoryRegistry

# 实体类
class Company(Base):
    def __init__(self, **kwargs):
        for key, value in kwargs.items():
            setattr(self, key, value)

    __tablename__ = 'companys'
    id = Column(Integer, primary_key=True)
    name = Column(String)

    def __repr__(self):
        return f"<Company(name={self.name})>"
    
def company_factory(**kwargs):
    return Company(**kwargs)

FactoryRegistry.register_factory('company', company_factory)
print("Company factory registered.")  # 打印确认消息
