Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
optifur
mango
Commits
7bd41444
Commit
7bd41444
authored
2 years ago
by
Necross Silverlight
🐺
Browse files
Options
Download
Plain Diff
Merge branch 'devel' into 'master'
fix default sort order See merge request wolf/mango!5
parents
c75a8731
64e0aa66
master
v0.0.8
v0.0.7
1 merge request
!5
fix default sort order
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
paging/paging.go
+9
-7
paging/paging.go
with
9 additions
and
7 deletions
+9
-7
paging/paging.go
View file @
7bd41444
...
...
@@ -20,7 +20,7 @@ const (
type
StdPaging
struct
{
Limit
*
int64
`mgo-paging:"limit,default: 10"`
Offset
*
int64
`mgo-paging:"offset"`
Sort
*
string
`mgo-paging:"sort,default: _id
_
"`
Sort
*
string
`mgo-paging:"sort,default: _id"`
}
// cacheLimit contains cached info for a limit paging data
...
...
@@ -124,17 +124,19 @@ func RegisterStruct(s interface{}) error {
// field and default value when applicable
// Eg:
// ```
// type SimplemPagingStruct struct {
// Limit *int64 `mgo-paging:"limit,default: 10"`
// Offset *int64 `mgo-paging:"offset"`
// Sort *string `mgo-paging:"sort,default: _id_"`
// }
//
// type SimplemPagingStruct struct {
// Limit *int64 `mgo-paging:"limit,default: 10"`
// Offset *int64 `mgo-paging:"offset"`
// Sort *string `mgo-paging:"sort,default: _id"`
// }
//
// ```
// The `default` opt is the default value, used when the field is a nil pointer.
// The `limit`, `offset` and `sort` value define what the field is used for.
// The sort field value should contain the key used for sorting. You can add a
// `-` as prefix to revert the sorting order.
// Eg: `-_id
_
`, `_id
_
`, `myField`, `-myField`
// Eg: `-_id`, `_id`, `myField`, `-myField`
func
GeneratePagination
(
s
interface
{})
(
res
options
.
FindOptions
,
err
error
)
{
// register paging struct. Will skip if already registered
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help