(Data): Small extensions to core data interfaces.
Add `LEQ` condition type. Ensure that batch updates don't fire with nothing to update. Add `cast_row` to `update_many` for handling typed `NULL`s.
This commit is contained in:
@@ -45,6 +45,21 @@ class GEQ(Condition):
|
||||
values.append(item)
|
||||
|
||||
|
||||
class LEQ(Condition):
|
||||
__slots__ = ('value',)
|
||||
|
||||
def __init__(self, value):
|
||||
self.value = value
|
||||
|
||||
def apply(self, key, values, conditions):
|
||||
item = self.value
|
||||
if isinstance(item, (list, tuple)):
|
||||
raise ValueError("Cannot apply LEQ condition to a list!")
|
||||
else:
|
||||
conditions.append("{} <= {}".format(key, _replace_char))
|
||||
values.append(item)
|
||||
|
||||
|
||||
class Constant(Condition):
|
||||
__slots__ = ('value',)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user