You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
371 B
21 lines
371 B
6 years ago
|
package query
|
||
|
|
||
|
import (
|
||
|
"github.com/mongodb/mongo-go-driver/bson"
|
||
|
)
|
||
|
|
||
|
// Sorter is a filter to sort the data before query
|
||
|
type Sorter interface {
|
||
|
Sort() bson.M
|
||
|
}
|
||
|
|
||
|
// Sort is a simple implementations of the Sorter filter
|
||
|
type Sort bson.M
|
||
|
|
||
|
var _ Sorter = &Sort{}
|
||
|
|
||
|
// Sort returns a slice of fields which have to be sorted
|
||
|
func (f Sort) Sort() bson.M {
|
||
|
return bson.M(f)
|
||
|
}
|