update object id funcs
This commit is contained in:
parent
449f377c95
commit
1627bbdb61
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue