Skip to content

Commit

Permalink
fix(type bson.ObjectID): fix bson.ObjectID type aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
amorist committed Jul 10, 2019
1 parent ee7dedf commit 05daabc
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions bson/bson.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package bson

import (
"bytes"
"encoding/hex"
"fmt"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
Expand Down Expand Up @@ -54,21 +52,7 @@ type M = primitive.M
type A = primitive.A

// ObjectID primitive.ObjectID
type ObjectID [12]byte

// Hex returns the hex encoding of the ObjectID as a string.
func (id ObjectID) Hex() string {
return hex.EncodeToString(id[:])
}

func (id ObjectID) String() string {
return fmt.Sprintf("ObjectID(%q)", id.Hex())
}

// IsZero returns true if id is the empty ObjectID.
func (id ObjectID) IsZero() bool {
return bytes.Equal(id[:], primitive.NilObjectID[:])
}
type ObjectID = primitive.ObjectID

// NewObjectID primitive.NewObjectID()
var NewObjectID = primitive.NewObjectID()
Expand Down

0 comments on commit 05daabc

Please sign in to comment.