parent
f859828370
commit
0b798fe818
@ -1,20 +1,20 @@ |
||||
package query |
||||
|
||||
import ( |
||||
"go.mongodb.org/mongo-driver/bson" |
||||
"go.mongodb.org/mongo-driver/bson/primitive" |
||||
) |
||||
|
||||
// Sorter is a filter to sort the data before query
|
||||
type Sorter interface { |
||||
Sort() (sort bson.M) |
||||
Sort() (sort primitive.M) |
||||
} |
||||
|
||||
// Sort is a simple implementations of the Sorter filter
|
||||
type Sort bson.M |
||||
type Sort primitive.M |
||||
|
||||
var _ Sorter = &Sort{} |
||||
|
||||
// Sort returns a slice of fields which have to be sorted
|
||||
func (f Sort) Sort() (sort bson.M) { |
||||
return bson.M(f) |
||||
func (f Sort) Sort() (sort primitive.M) { |
||||
return primitive.M(f) |
||||
} |
||||
|
@ -1,20 +1,20 @@ |
||||
package query |
||||
|
||||
import ( |
||||
"go.mongodb.org/mongo-driver/bson" |
||||
"go.mongodb.org/mongo-driver/bson/primitive" |
||||
) |
||||
|
||||
// Updater is a filter to update the data
|
||||
type Updater interface { |
||||
Update() (update bson.A) |
||||
Update() (update primitive.A) |
||||
} |
||||
|
||||
// Update is a simple implementations of the Updater filter
|
||||
type Update bson.M |
||||
type Update primitive.M |
||||
|
||||
var _ Updater = &Update{} |
||||
|
||||
// Update returns an update command
|
||||
func (u Update) Update() (update bson.A) { |
||||
return bson.A{bson.M(u)} |
||||
func (u Update) Update() (update primitive.A) { |
||||
return primitive.A{primitive.M(u)} |
||||
} |
||||
|
Loading…
Reference in new issue