How to use the pglast.printer.special_function function in pglast

To help you get started, we’ve selected a few pglast examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lelit / pglast / tests / test_printer.py View on Github external
        @printer.special_function('foo.test_function')
        def test(node, output):
            pass
github lelit / pglast / tests / test_printer.py View on Github external
        @printer.special_function('foo.test_function', override=True)
        def test_function(node, output):
            output.print_list(node.args, '-')
github lelit / pglast / tests / test_printer.py View on Github external
            @printer.special_function('foo.test_function')
            def test1(node, output):
                pass
github lelit / pglast / pglast / printers / sfuncs.py View on Github external
@special_function('pg_catalog.date_part')
def date_part(node, output):
    """
    Emit function ``pg_catalog.date_part(field, timestamp)`` as
    ``EXTRACT(field FROM timestamp)``.
    """
    output.write('EXTRACT(')
    output.write(node.args[0].val.str.value.upper())
    output.write(' FROM ')
    output.print_node(node.args[1])
    output.write(')')
github lelit / pglast / pglast / printers / sfuncs.py View on Github external
@special_function('pg_catalog.timezone')
def timezone(node, output):
    """
    Emit function ``pg_catalog.timezone(tz, timestamp)`` as ``timestamp AT TIME ZONE tz``.
    """
    output.print_node(node.args[1])
    output.write(' AT TIME ZONE ')
    output.print_node(node.args[0])
github lelit / pglast / pglast / printers / sfuncs.py View on Github external
@special_function('pg_catalog.overlaps')
def overlaps(node, output):
    "Emit function ``pg_catalog.overlaps(a, b, c, d)`` as ``(a, b) OVERLAPS (c, d)``."
    output.write('(')
    output.print_list((node.args[0], node.args[1]), standalone_items=False)
    output.write(') OVERLAPS (')
    output.print_list((node.args[2], node.args[3]), standalone_items=False)
    output.write(')')