mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
parent
6823b09406
commit
630b40038e
2 changed files with 38 additions and 13 deletions
7
app.py
7
app.py
|
|
@ -325,14 +325,17 @@ def build_where_clause(args):
|
|||
'contains': '"{}" like ?',
|
||||
'endswith': '"{}" like ?',
|
||||
'startswith': '"{}" like ?',
|
||||
'gt': '"{}" > ?',
|
||||
'gte': '"{}" >= ?',
|
||||
'lt': '"{}" < ?',
|
||||
'lte': '"{}" <= ?',
|
||||
}[lookup]
|
||||
value = values[0]
|
||||
value_convert = {
|
||||
'exact': lambda s: s,
|
||||
'contains': lambda s: '%{}%'.format(s),
|
||||
'endswith': lambda s: '%{}'.format(s),
|
||||
'startswith': lambda s: '{}%'.format(s),
|
||||
}[lookup]
|
||||
}.get(lookup, lambda s: s)
|
||||
converted = value_convert(value)
|
||||
sql_bits.append(
|
||||
(template.format(column), converted)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue