SwiftKuery-ORM: find with order/offset/limit

There's a PR for KueryORM that adds order/offset/limit to the APIs. It's been lingering for a while, but I'm just curious whether others think of this API? Does it feel clean/extensible to you?

For reference, the original API's looked like this:

  static func findAll(using db: Database? = nil, _ onCompletion: @escaping ([Self]?, RequestError?) -> Void)

And the new ones look like this:

static func findAll(using db: Database? = nil, order: Order..., offset: Int? = nil, limit: Int? = nil, _ onCompletion: @escaping ([Self]?, RequestError?) -> Void) 

I think this is a good addition to the ORM. You really need these functions quite often, and I guess most of us have implemented it or move away from ORM due to that. I'm for it!

Concerning the API, since the work as been submitted a while back, I'm not sure about the QueryParams usage. Now you can use Order and Filter inside a QueryParams, so maybe we should keep the API consistent there and also more flexible?

Terms of Service

Privacy Policy

Cookie Policy