diff --git a/app.py b/app.py index 8806fa8f..3018ab74 100644 --- a/app.py +++ b/app.py @@ -329,6 +329,8 @@ def build_where_clause(args): 'gte': '"{}" >= ?', 'lt': '"{}" < ?', 'lte': '"{}" <= ?', + 'glob': '"{}" glob ?', + 'like': '"{}" like ?', }[lookup] value = values[0] value_convert = { diff --git a/test_helpers.py b/test_helpers.py index 4f00ef55..8a4e006f 100644 --- a/test_helpers.py +++ b/test_helpers.py @@ -100,6 +100,14 @@ def test_custom_json_encoder(obj, expected): '"bar" > ? and "bax" <= ? and "baz" >= ? and "foo" < ?', ['2', '4', '3', '1'] ), + ( + { + 'foo__like': ['2%2'], + 'zax__glob': ['3*'], + }, + '"foo" like ? and "zax" glob ?', + ['2%2', '3*'] + ), ]) def test_build_where(args, expected_where, expected_params): actual_where, actual_params = app.build_where_clause(args)