diff --git a/between.go b/between.go index 74881db..1f578c1 100644 --- a/between.go +++ b/between.go @@ -11,7 +11,7 @@ const ( // // Example: // -// govalidator.BetweenInt(21, 1, 10, "age", "age must be between 1 and 10.") +// validator.BetweenInt(21, 1, 10, "age", "age must be between 1 and 10.") func (v *Validator) BetweenInt(i, min, max int, field, msg string) *Validator { v.Check(i >= min && i <= max, field, v.msg(Between, msg, field, min, max)) @@ -22,7 +22,7 @@ func (v *Validator) BetweenInt(i, min, max int, field, msg string) *Validator { // // Example: // -// govalidator.BetweenFloat(3.5, 2.0, 5.0, "height", "height must be between 2.0 and 5.0 meters.") +// validator.BetweenFloat(3.5, 2.0, 5.0, "height", "height must be between 2.0 and 5.0 meters.") func (v *Validator) BetweenFloat(f, min, max float64, field, msg string) *Validator { v.Check(f >= min && f <= max, field, v.msg(Between, msg, field, min, max)) diff --git a/date.go b/date.go index 920f669..3d43a35 100644 --- a/date.go +++ b/date.go @@ -15,7 +15,7 @@ const ( // // Example: // -// govalidator.Date("2006-01-02", "2024-03-09","birthdate", "birthdate must be a valid date in the format YYYY-MM-DD.") +// validator.Date("2006-01-02", "2024-03-09","birthdate", "birthdate must be a valid date in the format YYYY-MM-DD.") func (v *Validator) Date(layout, d, field, msg string) *Validator { _, err := time.Parse(layout, d) if err != nil { diff --git a/email.go b/email.go index ea8d1f5..82ffda8 100644 --- a/email.go +++ b/email.go @@ -13,7 +13,7 @@ const ( // // Example: // -// govalidator.Email("john.doe@example.com", "email", "email address is not valid.") +// validator.Email("john.doe@example.com", "email", "email address is not valid.") func (v *Validator) Email(s, field, msg string) *Validator { v.RegexMatches(s, EmailRegex, field, v.msg(Email, msg, field)) diff --git a/exists.go b/exists.go index 874a1f3..4bfb947 100644 --- a/exists.go +++ b/exists.go @@ -11,7 +11,7 @@ const ( // // Example: // -// govalidator.Exists(42, "users", "id", "user_id", "user with id 42 does not exist.") +// validator.Exists(42, "users", "id", "user_id", "user with id 42 does not exist.") func (v *Validator) Exists(value any, table, column, field, msg string) *Validator { v.Check(v.repo.Exists(value, table, column), field, v.msg(Exists, msg, field)) diff --git a/len.go b/len.go index 4b3a7b9..7fa4ff8 100644 --- a/len.go +++ b/len.go @@ -20,7 +20,7 @@ const ( // // Example: // -// govalidator.LenString("rez", 5, "username", "username must be 5 characters.") +// validator.LenString("rez", 5, "username", "username must be 5 characters.") func (v *Validator) LenString(s string, size int, field, msg string) *Validator { v.Check(len(strings.TrimSpace(s)) == size, field, v.msg(Len, msg, field, size)) @@ -31,7 +31,7 @@ func (v *Validator) LenString(s string, size int, field, msg string) *Validator // // Example: // -// govalidator.LenInt(12345, 5, "zipcode", "Zip code must be 5 digits long.") +// validator.LenInt(12345, 5, "zipcode", "Zip code must be 5 digits long.") func (v *Validator) LenInt(i, size int, field, msg string) *Validator { v.Check(len(strconv.Itoa(i)) == size, field, v.msg(Len, msg, field, size)) @@ -42,7 +42,7 @@ func (v *Validator) LenInt(i, size int, field, msg string) *Validator { // // Example: // -// govalidator.LenSlice([]int{1, 2, 3, 4, 5}, 5, "numbers", "the list must contain exactly 5 numbers.") +// validator.LenSlice([]int{1, 2, 3, 4, 5}, 5, "numbers", "the list must contain exactly 5 numbers.") func (v *Validator) LenSlice(s []any, size int, field, msg string) *Validator { v.Check(len(s) == size, field, v.msg(LenList, msg, field, size)) diff --git a/max.go b/max.go index 5158148..60d0ef8 100644 --- a/max.go +++ b/max.go @@ -17,7 +17,7 @@ const ( // // Example: // -// govalidator.MaxInt(10, 100, "age", "age must be less than 100.") +// validator.MaxInt(10, 100, "age", "age must be less than 100.") func (v *Validator) MaxInt(i, max int, field, msg string) *Validator { v.Check(i <= max, field, v.msg(Max, msg, field, max)) @@ -28,7 +28,7 @@ func (v *Validator) MaxInt(i, max int, field, msg string) *Validator { // // Example: // -// govalidator.MaxFloat(3.5, 5.0, "height", "height must be less than 5.0 meters.") +// validator.MaxFloat(3.5, 5.0, "height", "height must be less than 5.0 meters.") func (v *Validator) MaxFloat(f, max float64, field, msg string) *Validator { v.Check(f <= max, field, v.msg(Max, msg, field, max)) @@ -39,7 +39,7 @@ func (v *Validator) MaxFloat(f, max float64, field, msg string) *Validator { // // Example: // -// govalidator.MaxString("rey", 5, "name", "name should has less than 5 characters.") +// validator.MaxString("rey", 5, "name", "name should has less than 5 characters.") func (v *Validator) MaxString(s string, maxLen int, field, msg string) *Validator { v.Check(len(strings.TrimSpace(s)) <= maxLen, field, v.msg(MaxString, msg, field, maxLen)) diff --git a/min.go b/min.go index e12ff45..b4e1197 100644 --- a/min.go +++ b/min.go @@ -17,7 +17,7 @@ const ( // // Example: // -// govalidator.MinInt(18, 0, "age", "age must be at least 0.") +// validator.MinInt(18, 0, "age", "age must be at least 0.") func (v *Validator) MinInt(i, min int, field, msg string) *Validator { v.Check(i >= min, field, v.msg(Min, msg, field, min)) @@ -28,7 +28,7 @@ func (v *Validator) MinInt(i, min int, field, msg string) *Validator { // // Example: // -// govalidator.MinFloat(5.0, 0.0, "height", "height must be at least 0.0 meters.") +// validator.MinFloat(5.0, 0.0, "height", "height must be at least 0.0 meters.") func (v *Validator) MinFloat(f, min float64, field, msg string) *Validator { v.Check(f >= min, field, v.msg(Min, msg, field, min)) @@ -39,7 +39,7 @@ func (v *Validator) MinFloat(f, min float64, field, msg string) *Validator { // // Example: // -// govalidator.MinString("rey", 5, "name", "name should has more than 5 characters.") +// validator.MinString("rey", 5, "name", "name should has more than 5 characters.") func (v *Validator) MinString(s string, minLen int, field, msg string) *Validator { v.Check(len(strings.TrimSpace(s)) >= minLen, field, v.msg(MinString, msg, field, minLen)) diff --git a/notexists.go b/notexists.go index 868fdc9..85bf8b7 100644 --- a/notexists.go +++ b/notexists.go @@ -12,7 +12,7 @@ const ( // // Example: // -// govalidator.NotExists(42, "users", "id", "user_id", "user with id 42 already exists.") +// validator.NotExists(42, "users", "id", "user_id", "user with id 42 already exists.") func (v *Validator) NotExists(value any, table, column, field, msg string) *Validator { v.Check(!v.repo.Exists(value, table, column), field, v.msg(NotExists, msg, field)) diff --git a/regex.go b/regex.go index 6016479..75ac57c 100644 --- a/regex.go +++ b/regex.go @@ -13,7 +13,7 @@ const ( // // Example: // -// govalidator.RegexMatches("example123", "[a-z]+[0-9]+", "input", "input must contain letters followed by numbers.") +// validator.RegexMatches("example123", "[a-z]+[0-9]+", "input", "input must contain letters followed by numbers.") func (v *Validator) RegexMatches(s string, pattern string, field, msg string) *Validator { r := regexp.MustCompile(pattern) diff --git a/required.go b/required.go index 8a76d93..236dec6 100644 --- a/required.go +++ b/required.go @@ -13,7 +13,7 @@ const ( // // Example: // -// govalidator.RequiredString("hello", "username", "username is required.") +// validator.RequiredString("hello", "username", "username is required.") func (v *Validator) RequiredString(s, field string, msg string) *Validator { v.Check(strings.TrimSpace(s) != "", field, v.msg(Required, msg, field)) @@ -24,7 +24,7 @@ func (v *Validator) RequiredString(s, field string, msg string) *Validator { // // Example: // -// govalidator.RequiredInt(42, "age", "age is required.") +// validator.RequiredInt(42, "age", "age is required.") func (v *Validator) RequiredInt(i int, field string, msg string) *Validator { v.Check(i != 0, field, v.msg(Required, msg, field)) @@ -35,7 +35,7 @@ func (v *Validator) RequiredInt(i int, field string, msg string) *Validator { // // Example: // -// govalidator.RequiredSlice([]string{"apple", "banana", "orange"}, "fruits", "at least one fruit must be provided.") +// validator.RequiredSlice([]string{"apple", "banana", "orange"}, "fruits", "at least one fruit must be provided.") func (v *Validator) RequiredSlice(s []any, field string, msg string) *Validator { v.Check(len(s) > 0, field, v.msg(Required, msg, field)) @@ -46,7 +46,7 @@ func (v *Validator) RequiredSlice(s []any, field string, msg string) *Validator // // Example: // -// govalidator.RequiredFloat(3.5, "weight", "weight is required.") +// validator.RequiredFloat(3.5, "weight", "weight is required.") func (v *Validator) RequiredFloat(f float64, field string, msg string) *Validator { v.Check(f != 0.0, field, v.msg(Required, msg, field)) diff --git a/uuid.go b/uuid.go index 0d88dfa..a9581cf 100644 --- a/uuid.go +++ b/uuid.go @@ -15,7 +15,7 @@ const ( // // Example: // -// govalidator.UUID("f47ac10b-58cc-4372-a567-0e02b2c3d479", "uuid", "Invalid UUID format.") +// validator.UUID("f47ac10b-58cc-4372-a567-0e02b2c3d479", "uuid", "Invalid UUID format.") func (v *Validator) UUID(u, field, msg string) *Validator { _, err := uuid.Parse(u) if err != nil { diff --git a/when.go b/when.go index 8e1093f..cb9ceac 100644 --- a/when.go +++ b/when.go @@ -4,8 +4,8 @@ package govalidator // // Example: // -// govalidator.When(len(username) > 0, func() { -// govalidator.RequiredString(username, "username", "username is required.") +// validator.When(len(username) > 0, func() { +// validator.RequiredString(username, "username", "username is required.") // }) func (v *Validator) When(condition bool, f func()) *Validator { if condition {