Closed
@kdorsel

Description

  • asyncpg version: 0.20.1
  • PostgreSQL version: 12.1
  • Python version: 3.7.7
  • Platform: macOS 10.15.4
  • Do you use pgbouncer?: No
  • Did you install asyncpg with pip?: Yes

I created a subclass of the Range type as follows:

from asyncpg.types import Range as Rg

class Range(Rg):
    def issubset(self, other):
        return self._lower >= other._lower and self._upper <= other._upper

    def issuperset(self, other):
        return self._upper >= other._upper and self._lower <= other._lower

    def size(self):
        return self._upper - self._lower

Would it be possible to have this subclass used automatically instead of the default type?

Both set_type_codec and set_builtin_type_codec don't seem to be able to do it.