kopia lustrzana https://github.com/simonw/datasette
Added glob and like lookups - refs #23
rodzic
630b40038e
commit
1c5977961f
2
app.py
2
app.py
|
@ -329,6 +329,8 @@ def build_where_clause(args):
|
|||
'gte': '"{}" >= ?',
|
||||
'lt': '"{}" < ?',
|
||||
'lte': '"{}" <= ?',
|
||||
'glob': '"{}" glob ?',
|
||||
'like': '"{}" like ?',
|
||||
}[lookup]
|
||||
value = values[0]
|
||||
value_convert = {
|
||||
|
|
|
@ -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)
|
||||
|
|
Ładowanie…
Reference in New Issue