def exists(self, data): """ For example: await User.remove(User.id.exists([1,2,3])) """ return _Where(column=self.name, operator='exists', value=data)
def in_(self, data): """ For example: await User.remove(User.id.in_([1,2,3])) """ return _Where(column=self.name, operator='in', value=data)
async def _delete(self): """ delete self """ self_pk = self.__table__.pk pk_value = self._get_value(self_pk) if pk_value is None: raise DeleteUnsavedError('Not allowed delete unsaved objects') return await self.remove( _Where(column=self_pk, operator='==', value=pk_value) )
def like(self, data): """ Similar `in` """ return _Where(column=self.name, operator='like', value=data)
def __le__(self, data): return _Where(column=self.name, operator='<=', value=data)