vapor-community / pagination

Simple Vapor 3 Pagination
MIT License
64 stars 15 forks source link

Public vars? #8

Closed khoogheem closed 6 years ago

khoogheem commented 6 years ago

any reason not to make the vars public?

public struct Position: Content {
    var current: Int
    var next: Int?
    var previous: Int?
    var max: Int
}
public struct PageData: Content {
    var per: Int
    var total: Int
}
public struct PageInfo: Content {
    var position: Position
    var data: PageData
}
public struct Paginated<M: Content>: Content {
    var page: PageInfo
    var data: [M]
}
anthonycastelli commented 6 years ago

I just double checked, and with the latest release, which is 1.0.2, they are public.

https://github.com/vapor-community/pagination/blob/a9edc1737ec8f2508b4748cf8f8e9276314c4cb7/Sources/Pagination/Paginated.swift#L12-L54

khoogheem commented 6 years ago
        return try Product.makePaginate(req).flatMap(to: View.self) { products in
           let max =  products.page.position.max

produces: 'page' is inaccessible due to 'internal' protection level

The vars default to internal if nothing is there..

anthonycastelli commented 6 years ago

Oh I see, the actual variables inside of the structs themselves. I'll fix that up and push an update for it. 👍

anthonycastelli commented 6 years ago

Go ahead and update to 1.0.3 https://github.com/vapor-community/pagination/releases/tag/1.0.3