Skip to content
8 changes: 4 additions & 4 deletions internal/partitions/bson.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ var bsonTypeString = map[bsontype.Type]string{
// This returns BSON types that the server’s type bracketing excludes from
// query results when matching against the given value.
//
// The returned slices are types before & after, respectively. They are
// strings rather than bsontype.Type to facilitate easy insertion into queries.
// The returned slices are types before & after, respectively. They require
// transformation (e.g., via typesToStrings()) before insertion into queries.
//
// This is kind of like strings.Cut() but against the sort-ordered list of BSON
// types, except that if the given value is a number or string-like, then other
// “like” types will not be in the returned slices.
func getTypeBracketExcludedBSONTypes(val any) ([]string, []string, error) {
func getTypeBracketExcludedBSONTypes(val any) ([]bsontype.Type, []bsontype.Type, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment for this function still says it returns string slices.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops! fixed

bsonType, _, err := bson.MarshalValue(val)
if err != nil {
return nil, nil, errors.Wrapf(err, "marshaling min value (%v)", val)
Expand Down Expand Up @@ -120,7 +120,7 @@ func getTypeBracketExcludedBSONTypes(val any) ([]string, []string, error) {
later = lo.Without(later, stringTypes...)
}

return typesToStrings(earlier), typesToStrings(later), nil
return earlier, later, nil
}

func typesToStrings(in []bsontype.Type) []string {
Expand Down
Loading