update object id funcs

This commit is contained in:
Nam Huynh 2021-08-09 11:56:18 +07:00
parent 449f377c95
commit 1627bbdb61
1 changed files with 4 additions and 4 deletions

View File

@ -12,14 +12,14 @@ func NewStringID() string {
return NewObjectID().Hex() return NewObjectID().Hex()
} }
// ConvertFromString ... // NewIDFromString ...
func ConvertFromString(s string) (value primitive.ObjectID, isValid bool) { func NewIDFromString(s string) (value primitive.ObjectID, isValid bool) {
id, err := primitive.ObjectIDFromHex(s) id, err := primitive.ObjectIDFromHex(s)
return id, err == nil return id, err == nil
} }
// IsValid ... // IsValidID ...
func IsValid(s string) bool { func IsValidID(s string) bool {
return primitive.IsValidObjectID(s) return primitive.IsValidObjectID(s)
} }