Documentation
¶
Index ¶
- func RemoveDuplicates[T comparable](ids []T) []T
- type Rules
- func (r *Rules) ErrInvalidDateMsg() string
- func (r *Rules) ErrInvalidImageURLMsg() string
- func (r *Rules) ErrInvalidImageURLsMsg() string
- func (r *Rules) ErrInvalidRatingMsg() string
- func (r *Rules) ErrInvalidWebsitesURLMsg() string
- func (r *Rules) ErrNonPositiveValuesMsg() string
- func (r *Rules) ErrRequiredMsg() string
- func (r *Rules) IsValidURL(urlStr string, allowedList []string) bool
- func (r *Rules) ValidateDate(date string) bool
- func (r *Rules) ValidateImageURLs(urls []string) bool
- func (r *Rules) ValidatePositive(slice []int32) bool
- func (r *Rules) ValidateWebsiteURLs(urls []string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RemoveDuplicates ¶
func RemoveDuplicates[T comparable](ids []T) []T
RemoveDuplicates removes duplicates from slice
Types ¶
type Rules ¶ added in v1.4.0
type Rules struct {
// contains filtered or unexported fields
}
Rules validates request fields and provides validation error messages
func NewRules ¶ added in v1.4.0
NewRules creates validation rules; allowed image domain is taken from CDN base URL
func (*Rules) ErrInvalidDateMsg ¶ added in v1.4.0
ErrInvalidDateMsg returns error message
func (*Rules) ErrInvalidImageURLMsg ¶ added in v1.4.0
ErrInvalidImageURLMsg returns error message
func (*Rules) ErrInvalidImageURLsMsg ¶ added in v1.4.0
ErrInvalidImageURLsMsg returns error message
func (*Rules) ErrInvalidRatingMsg ¶ added in v1.4.0
ErrInvalidRatingMsg returns error message
func (*Rules) ErrInvalidWebsitesURLMsg ¶ added in v1.4.0
ErrInvalidWebsitesURLMsg returns error message
func (*Rules) ErrNonPositiveValuesMsg ¶ added in v1.4.0
ErrNonPositiveValuesMsg returns error message
func (*Rules) ErrRequiredMsg ¶ added in v1.4.0
ErrRequiredMsg returns error message
func (*Rules) IsValidURL ¶ added in v1.4.0
IsValidURL checks if the URL is from an allowed domain list
func (*Rules) ValidateDate ¶ added in v1.4.0
ValidateDate validates date format (YYYY-MM-DD)
func (*Rules) ValidateImageURLs ¶ added in v1.4.0
ValidateImageURLs checks if URLs are from an allowed image CDN domain
func (*Rules) ValidatePositive ¶ added in v1.4.0
ValidatePositive checks if all slice values are positive
func (*Rules) ValidateWebsiteURLs ¶ added in v1.4.0
ValidateWebsiteURLs checks if URLs are from allowed websites