12 lines
238 B
Go
12 lines
238 B
Go
|
package mongodb
|
||
|
|
||
|
import "go.mongodb.org/mongo-driver/bson/primitive"
|
||
|
|
||
|
func MustObjectID(id string) primitive.ObjectID {
|
||
|
objectID, err := primitive.ObjectIDFromHex(id)
|
||
|
if err != nil {
|
||
|
return primitive.NilObjectID
|
||
|
}
|
||
|
return objectID
|
||
|
}
|