diff --git a/README.md b/README.md index 6c14bbf..3c9366c 100644 --- a/README.md +++ b/README.md @@ -666,6 +666,7 @@ Below is the whole list of the rules provided by the `is` package: * `UUIDv4`: validates if a string is a valid version 4 UUID * `UUIDv5`: validates if a string is a valid version 5 UUID * `UUID`: validates if a string is a valid UUID +* `ULID`: validates if a string is a valid ULID * `CreditCard`: validates if a string is a valid credit card number * `ISBN10`: validates if a string is an ISBN version 10 * `ISBN13`: validates if a string is an ISBN version 13 diff --git a/go.mod b/go.mod index 359af94..e9e5761 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,6 @@ module github.com/go-ozzo/ozzo-validation/v4 go 1.13 require ( - github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496 + github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d github.com/stretchr/testify v1.4.0 ) diff --git a/go.sum b/go.sum index 7e52201..3fd30f3 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,9 @@ -github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496 h1:zV3ejI06GQ59hwDQAvmK1qxOQGB3WuVTRoY0okPTAv0= -github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= +github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ= +github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= diff --git a/is/rules.go b/is/rules.go index 3cad215..ce18f40 100644 --- a/is/rules.go +++ b/is/rules.go @@ -58,6 +58,8 @@ var ( ErrUUIDv5 = validation.NewError("validation_is_uuid_v5", "must be a valid UUID v5") // ErrUUID is the error that returns in case of an invalid UUID value. ErrUUID = validation.NewError("validation_is_uuid", "must be a valid UUID") + // ErrULID is the error that returns in case of an invalid ULID value. + ErrULID = validation.NewError("validation_is_ulid", "must be a valid ULID") // ErrCreditCard is the error that returns in case of an invalid credit card number. ErrCreditCard = validation.NewError("validation_is_credit_card", "must be a valid credit card number") // ErrISBN10 is the error that returns in case of an invalid ISBN-10 value. @@ -171,6 +173,8 @@ var ( UUIDv5 = validation.NewStringRuleWithError(govalidator.IsUUIDv5, ErrUUIDv5) // UUID validates if a string is a valid UUID UUID = validation.NewStringRuleWithError(govalidator.IsUUID, ErrUUID) + // ULID validates if a string is a valid ULID + ULID = validation.NewStringRuleWithError(govalidator.IsULID, ErrULID) // CreditCard validates if a string is a valid credit card number CreditCard = validation.NewStringRuleWithError(govalidator.IsCreditCard, ErrCreditCard) // ISBN10 validates if a string is an ISBN version 10