File tree 2 files changed +16
-0
lines changed
2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -397,6 +397,9 @@ def find_all(
397
397
with_rels = None ,
398
398
with_joins = None ,
399
399
with_lazy = False ,
400
+ order_by = None ,
401
+ limit = None ,
402
+ offset = None ,
400
403
** cols ,
401
404
) -> CompositeResultSet :
402
405
where = SQL .And ([])
@@ -407,6 +410,12 @@ def find_all(
407
410
stmt = cls .select_from (with_rels = with_rels , with_joins = with_joins , with_lazy = with_lazy )
408
411
if where :
409
412
stmt = stmt .where (where )
413
+ if order_by :
414
+ stmt = stmt .order_by (order_by )
415
+ if limit :
416
+ stmt = stmt .limit (limit )
417
+ if offset :
418
+ stmt = stmt .offset (offset )
410
419
return cls .query (stmt )
411
420
412
421
@classmethod
@@ -416,6 +425,7 @@ def find_one(
416
425
with_rels = None ,
417
426
with_joins = None ,
418
427
with_lazy = False ,
428
+ order_by = None ,
419
429
** cols ,
420
430
):
421
431
where = SQL .And ([])
@@ -426,6 +436,8 @@ def find_one(
426
436
stmt = cls .select_from (with_rels = with_rels , with_joins = with_joins , with_lazy = with_lazy )
427
437
if where :
428
438
stmt = stmt .where (where )
439
+ if order_by :
440
+ stmt = stmt .order_by (order_by )
429
441
return cls .query (stmt .limit (1 )).first ()
430
442
431
443
@classmethod
Original file line number Diff line number Diff line change @@ -74,9 +74,13 @@ def __le__(self, other):
74
74
return self .op ("<=" , other )
75
75
76
76
def __eq__ (self , other ):
77
+ if other is None :
78
+ return SQL (self , "IS NULL" )
77
79
return self .op ("=" , other )
78
80
79
81
def __ne__ (self , other ):
82
+ if other is None :
83
+ return SQL (self , "IS NOT NULL" )
80
84
return self .op ("!=" , other )
81
85
82
86
def __gt__ (self , other ):
You can’t perform that action at this time.
0 commit comments