Compare commits
No commits in common. "3d1c1d7538163142e76978693afce8fe96e5b806" and "7dff7ac4e0040fc86dee17ba82db92b9c0e8b25c" have entirely different histories.
3d1c1d7538
...
7dff7ac4e0
|
@ -7,8 +7,6 @@ import (
|
||||||
"go.mongodb.org/mongo-driver/mongo/options"
|
"go.mongodb.org/mongo-driver/mongo/options"
|
||||||
)
|
)
|
||||||
|
|
||||||
const maxLimit = 500
|
|
||||||
|
|
||||||
// CommonQuery ...
|
// CommonQuery ...
|
||||||
type CommonQuery struct {
|
type CommonQuery struct {
|
||||||
Page int64
|
Page int64
|
||||||
|
@ -80,12 +78,9 @@ func (q *CommonQuery) GetFindOptionsUsingPage() *options.FindOptions {
|
||||||
|
|
||||||
// SetDefaultLimit ...
|
// SetDefaultLimit ...
|
||||||
func (q *CommonQuery) SetDefaultLimit() {
|
func (q *CommonQuery) SetDefaultLimit() {
|
||||||
if q.Limit <= 0 {
|
if q.Limit <= 0 || q.Limit > 20 {
|
||||||
q.Limit = 20
|
q.Limit = 20
|
||||||
}
|
}
|
||||||
if q.Limit > maxLimit {
|
|
||||||
q.Limit = 500
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssignOther ...
|
// AssignOther ...
|
||||||
|
|
Loading…
Reference in New Issue