Skip to content

Commit

Permalink
Merge pull request #51 from rezakhademix/better-constants-commentes
Browse files Browse the repository at this point in the history
improved: constants comments
  • Loading branch information
rezakhademix authored Mar 9, 2024
2 parents ec66c98 + 770ccb6 commit 7fc69d1
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions between.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package validator

const (
// Between represents the rule name which will be used to find the default error message.
// Between represents rule name which will be used to find the default error message.
Between = "between"
// BetweenMsg is the default error message format for between rule.
// BetweenMsg is the default error message format for fields with Between rule.
BetweenMsg = "%s should be greater than or equal %v and less than or equal %v"
)

Expand Down
4 changes: 2 additions & 2 deletions date.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
)

const (
// Date represents the rule name which will be used to find the default error message.
// Date represents rule name which will be used to find the default error message.
Date = "date"
// DateMsg is the default error message format for fields with the Date validation rule.
// DateMsg is the default error message format for fields with Date validation rule.
DateMsg = "%s has wrong date format"
)

Expand Down
4 changes: 2 additions & 2 deletions email.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package validator

const (
// Email represents the rule name which will be used to find the default error message.
// Email represents rule name which will be used to find the default error message.
Email = "email"
// EmailMsg is the default error message format for fields with the email validation rule.
// EmailMsg is the default error message format for fields with Email validation rule.
EmailMsg = "%s is not valid"
// EmailRegex is the default pattern to validate email field by RFC 5322 rule.
EmailRegex = "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\\])"
Expand Down
4 changes: 2 additions & 2 deletions exists.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package validator

const (
// Exists represents the rule name which will be used to find the default error message.
// Exists represents rule name which will be used to find the default error message.
Exists = "exists"
// ExistsMsg is default error message format for records that does not exist.
// ExistsMsg is default error message format for fields with Exists validation rule.
ExistsMsg = "%s does not exist"
)

Expand Down
8 changes: 4 additions & 4 deletions len.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (
)

const (
// Len represents the rule name which will be used to find the default error message.
// Len represents rule name which will be used to find the default error message.
Len = "len"
// LenList represents the rule name which will be used to find the default error message.
// LenList represents rule name which will be used to find the default error message.
LenList = "lenList"
// LenMsg is the default error message format for Len validation rule.
// LenMsg is the default error message format for fields with Len validation rule.
LenMsg = "%s should be %d characters"
// LenListMsg is the default error message format for LenSlice validation rule.
// LenListMsg is the default error message format for fields with LenList validation rule.
LenListMsg = "%s should have %d items"
)

Expand Down
8 changes: 4 additions & 4 deletions max.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package validator
import "strings"

const (
// Max represents the rule name which will be used to find the default error message.
// Max represents rule name which will be used to find the default error message.
Max = "max"
// MaxString represents the rule name which will be used to find the default error message.
// MaxString represents rule name which will be used to find the default error message.
MaxString = "maxString"
// MaxMsg is the default error message format for fields with the maximum validation rule.
// MaxMsg is the default error message format for fields with Max validation rule.
MaxMsg = "%s should be less than %v"
// MaxStringMsg is the default error message format for fields with the MaxString validation rule.
// MaxStringMsg is the default error message format for fields with MaxString validation rule.
MaxStringMsg = "%s should has less than %v characters"
)

Expand Down
6 changes: 3 additions & 3 deletions min.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package validator
import "strings"

const (
// Min represents the rule name which will be used to find the default error message.
// Min represents rule name which will be used to find the default error message.
Min = "min"
// MinString represents the rule name which will be used to find the default error message.
MinString = "minString"
// MinMsg is the default error message format for fields with the minimum validation rule.
// MinMsg is the default error message format for fields with Min validation rule.
MinMsg = "%s should be more than %v"
// MinStringMsg is the default error message format for fields with the MinString validation rule.
// MinStringMsg is the default error message format for fields with MinString validation rule.
MinStringMsg = "%s should has more than %v characters"
)

Expand Down
4 changes: 2 additions & 2 deletions notexists.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package validator

const (
// NotExists represents the rule name which will be used to find the default error message.
// NotExists represents rule name which will be used to find the default error message.
NotExists = "notExists"

// NotExistsMsg is default error message format for records that don't exist.
// NotExistsMsg is default error message format for fields with with NotExists validation rule.
NotExistsMsg = "%s already exists"
)

Expand Down
4 changes: 2 additions & 2 deletions regex.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package validator
import "regexp"

const (
// Regex represents the rule name which will be used to find the default error message.
// Regex represents rule name which will be used to find the default error message.
Regex = "regex"
// RegexMsg is the default error message format for fields with the regex validation rule.
// RegexMsg is the default error message format for fields with the Regex validation rule.
RegexMsg = "%s is not valid"
)

Expand Down
4 changes: 2 additions & 2 deletions required.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package validator
import "strings"

const (
// Required represents the rule name which will be used to find the default error message.
// Required represents rule name which will be used to find the default error message.
Required = "required"
// RequiredMsg is the default error message format for required fields.
// RequiredMsg is the default error message format for fields with required validation rule.
RequiredMsg = "%s is required"
)

Expand Down
2 changes: 1 addition & 1 deletion uuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package validator
import "github.com/google/uuid"

const (
// UUID represents the rule name which will be used to find the default error message.
// UUID represents rule name which will be used to find the default error message.
UUID = "uuid"
// UUIDMsg is the default error message format for fields with the UUID validation rule.
UUIDMsg = "%s is not a valid UUID"
Expand Down

0 comments on commit 7fc69d1

Please sign in to comment.