Beispiel #1
0
    def exists(self, data):
        """
        For example:
            await User.remove(User.id.exists([1,2,3]))
        """

        return _Where(column=self.name, operator='exists', value=data)
Beispiel #2
0
    def in_(self, data):
        """
        For example:
            await User.remove(User.id.in_([1,2,3]))
        """

        return _Where(column=self.name, operator='in', value=data)
Beispiel #3
0
    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)
        )
Beispiel #4
0
    def like(self, data):
        """ Similar `in` """

        return _Where(column=self.name, operator='like', value=data)
Beispiel #5
0
 def __le__(self, data):
     return _Where(column=self.name, operator='<=', value=data)