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()
}
// ConvertFromString ...
func ConvertFromString(s string) (value primitive.ObjectID, isValid bool) {
// NewIDFromString ...
func NewIDFromString(s string) (value primitive.ObjectID, isValid bool) {
id, err := primitive.ObjectIDFromHex(s)
return id, err == nil
}
// IsValid ...
func IsValid(s string) bool {
// IsValidID ...
func IsValidID(s string) bool {
return primitive.IsValidObjectID(s)
}