Closed Valbou closed 1 year ago
Create a query builder like Django QuerySet. It give reusable query and inheritance capabilities.
base = TagQueryset() base.select().owner(user_id).done(True)
class Queryset: def __init__(self, qs_class): self.query = select(qs_class) def owner(self, user_id) -> Self: self.query = self.query.where(qs_class.user_id == user_id) return self class TagQueryset: def __init__(self): self.query = select(Tag)
Create a query builder like Django QuerySet. It give reusable query and inheritance capabilities.