generated from HoloTech/holotech-plugin-template
22 lines
502 B
Python
22 lines
502 B
Python
from typing import Any
|
|
from psycopg import sql
|
|
|
|
from data import RawExpr, Expression
|
|
|
|
|
|
def LOWER(expression: Expression) -> RawExpr:
|
|
"""
|
|
Wrap an Expression in the SQL function LOWER().
|
|
"""
|
|
expr, values = expression.as_tuple()
|
|
final_expr = sql.SQL("LOWER({})").format(expr)
|
|
final_values = values
|
|
|
|
return RawExpr(final_expr, final_values)
|
|
|
|
def asexpr(value: Any) -> RawExpr:
|
|
"""
|
|
Turn a value into an expression.
|
|
"""
|
|
return RawExpr(sql.Placeholder(), (value,))
|