Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@printer.special_function('foo.test_function')
def test(node, output):
pass
@printer.special_function('foo.test_function', override=True)
def test_function(node, output):
output.print_list(node.args, '-')
@printer.special_function('foo.test_function')
def test1(node, output):
pass
@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(')')
@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])
@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(')')