SP/web2py/gluon/packages/dal/pydal/parsers/postgre.py
Saturneic 064f602b1a Add.
2018-10-25 23:33:13 +08:00

37 lines
793 B
Python

from ..adapters.postgres import Postgre, PostgreNew, PostgreBoolean
from .base import BasicParser, ListsParser, JSONParser
from . import parsers, for_type
@parsers.register_for(Postgre)
class PostgreParser(ListsParser, JSONParser):
@for_type('jsonb')
def _jsonb(self, value):
return self.json(value)
class PostgreAutoJSONParser(ListsParser):
pass
@parsers.register_for(PostgreNew)
class PostgreNewParser(JSONParser):
pass
class PostgreNewAutoJSONParser(BasicParser):
pass
@parsers.register_for(PostgreBoolean)
class PostgreBooleanParser(JSONParser):
@for_type('boolean')
def _boolean(self, value):
return value
class PostgreBooleanAutoJSONParser(BasicParser):
@for_type('boolean')
def _boolean(self, value):
return value