IMO:
.where('column_a', '=', 'value1') .and(q => q.isNull('column_b').orWhere('column_b', '=', 'value2')))
WHERE column_a = 'value1' AND (column_b IS NULL OR column_b = 'value2')
And obviously you can use whatever indentations you like.
- No keyword arguments
- No operator overloading (so you can't override | to get the nice "or" syntax)
In JS, theoretically you could design an API like
.where({column_a: 1}, Q(column_b__isnull=True).or({column_b: 2}))
Which really isn't bad IMO
filter( Q(column_b__isnull=True)|Q(column_b='value2'), column_a='value1', )
.filter(Q(column_a='value1'), Q(column_b__isnull=True)|Q(column_b='value2'))
.filter(Q(column_a='value1') & (Q(column_b__isnull=True) | Q(column_b='value2')))
IMO:
is a lot less readable than: