mirror of
https://github.com/hanzo-fi/stack.git
synced 2026-10-30 20:34:43 +00:00
31 lines
706 B
Go
31 lines
706 B
Go
package bunpaginate
|
|
|
|
import (
|
|
"github.com/formancehq/stack/libs/go-libs/query"
|
|
)
|
|
|
|
type PaginatedQueryOptions[T any] struct {
|
|
QueryBuilder query.Builder `json:"qb"`
|
|
PageSize uint64 `json:"pageSize"`
|
|
Options T `json:"options"`
|
|
}
|
|
|
|
func (opts PaginatedQueryOptions[T]) WithQueryBuilder(qb query.Builder) PaginatedQueryOptions[T] {
|
|
opts.QueryBuilder = qb
|
|
|
|
return opts
|
|
}
|
|
|
|
func (opts PaginatedQueryOptions[T]) WithPageSize(pageSize uint64) PaginatedQueryOptions[T] {
|
|
opts.PageSize = pageSize
|
|
|
|
return opts
|
|
}
|
|
|
|
func NewPaginatedQueryOptions[T any](options T) PaginatedQueryOptions[T] {
|
|
return PaginatedQueryOptions[T]{
|
|
Options: options,
|
|
PageSize: QueryDefaultPageSize,
|
|
}
|
|
}
|