File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -179,24 +179,28 @@ type PaginatorSettings struct {
179179
180180type PaginatorOption func (* PaginatorSettings )
181181
182+ // WithDefaultSize sets the default page size.
182183func WithDefaultSize (size uint32 ) PaginatorOption {
183184 return func (s * PaginatorSettings ) {
184185 s .DefaultSize = size
185186 }
186187}
187188
189+ // WithMaxSize sets the maximum page size.
188190func WithMaxSize (size uint32 ) PaginatorOption {
189191 return func (s * PaginatorSettings ) {
190192 s .MaxSize = size
191193 }
192194}
193195
194- func WithDefaultSort (sort ... string ) PaginatorOption {
196+ // WithSort sets the default sort order.
197+ func WithSort (sort ... string ) PaginatorOption {
195198 return func (s * PaginatorSettings ) {
196199 s .Sort = sort
197200 }
198201}
199202
203+ // WithColumnFunc sets a function to transform column names.
200204func WithColumnFunc (f func (string ) string ) PaginatorOption {
201205 return func (s * PaginatorSettings ) {
202206 s .ColumnFunc = f
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ func TestPagination(t *testing.T) {
1717 pgkit .WithColumnFunc (strings .ToLower ),
1818 pgkit .WithDefaultSize (2 ),
1919 pgkit .WithMaxSize (_MaxSize ),
20- pgkit .WithDefaultSort ("ID" ),
20+ pgkit .WithSort ("ID" ),
2121 }
2222 paginator := pgkit .NewPaginator [T ](options ... )
2323 page := pgkit .NewPage (0 , 0 )
You can’t perform that action at this time.
0 commit comments