Ejemplo n.º 1
0
 def to_query(self, id: int) -> str:
     user_temp = User(0, 0, 0, 0, 0, 0, 0, 0, 0)
     query = '{}=FALSE, {}={} WHERE {}={} RETURNING *;'.format(
         user_temp.validation_name(), user_temp.delete_date_name(),
         self.conversor.to_entity(
             user_temp.define_type(user_temp.delete_date_name()),
             datetime.datetime.now()), user_temp.id_name(), id)
     return query
Ejemplo n.º 2
0
    def to_entity(self, data: User) -> str:
        datas = str(data)
        query = ''

        for i in datas.split(','):
            temp = data.to_dict().get(i.strip())
            if (temp):
                type_data = data.define_type(i.strip())
                query += '{} = {},'.format(
                    i.strip(), self.conversor.to_entity(type_data, temp))

        query = query[:-1]
        return query
Ejemplo n.º 3
0
    def to_entity(self, data: User) -> (str, str):
        datas = str(data)
        query = definitions = ''

        for i in datas.split(','):
            temp = data.to_dict().get(i.strip())
            if (temp):
                type_data = data.define_type(i.strip())
                query += self.conversor.to_entity(type_data, temp)
                definitions += i.strip()
                query += ','
                definitions += ','

        query = query[:-1]
        definitions = definitions[:-1]
        return (query, definitions)