v0.0.264 added Valid() to id-gen
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 49s

This commit is contained in:
2023-09-18 11:46:17 +02:00
parent 3d4afe7b25
commit da52bb5c90
2 changed files with 9 additions and 2 deletions

View File

@@ -209,6 +209,13 @@ func fmtIDOutput(cs string, ids []IDDef, pkgname string) string {
str += "" + "\n"
str += "func (i " + iddef.Name + ") Valid() bool {" + "\n"
str += " _, err := primitive.ObjectIDFromHex(string(i))" + "\n"
str += " return err == nil" + "\n"
str += "}" + "\n"
str += "" + "\n"
if anyDef != nil {
str += "func (i " + iddef.Name + ") AsAny() " + anyDef.Name + " {" + "\n"
str += " return " + anyDef.Name + "(i)" + "\n"