generated from HoloTech/holotech-plugin-template
Registry, tw interface draft, sub handler
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
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,))
|
||||
Reference in New Issue
Block a user