from utils.rdbmsUtil.databaseUtil import sql_operation
from utils.rdbmsUtil.modelUser import User
from sqlalchemy.sql import text
from sqlalchemy.orm import Session


def sqlOfUpsert(company):
    return "INSERT INTO companys (id,name) VALUES (:id,:name) ON CONFLICT (id) DO UPDATE SET name = :name"

class CompanyOperations:
    @sql_operation("INSERT INTO companys (id,name) VALUES (:id,:name) ON CONFLICT (id) DO UPDATE SET name = :name", entity_type='company', batch=True)
    def upsert_companys(self, session: Session, companys):
        pass