Commit 7bd41444 authored by Necross Silverlight's avatar Necross Silverlight 🐺
Browse files

Merge branch 'devel' into 'master'

fix default sort order

See merge request wolf/mango!5
1 merge request!5fix default sort order
Showing with 9 additions and 7 deletions
+9 -7
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment