UnaryExpression

MySQL 中的一元表达式

实现了 SQLLiteralInterface

实例方法

__init__

函数签名: def __init__(self, value, operator):

参数:

用法:

exp = UnaryExpression(Dummy.id, 'DESC')
assert exp.get_sql_and_params()  == ('`id` DESC', [])

exp = UnaryExpression(
    BinaryExpression(Dummy.age, Dummy.id, '-'),
    'DESC'
)
assert exp.get_sql_and_params() == ('(`age` - `id`) DESC', [])