Documentation ¶
Index ¶
- Variables
- func ValidateLength(fieldName string, fieldValue string, minLen int, maxLen int) error
- func ValidateRequired(fieldName string, fieldValue string) error
- type PM
- type Post
- type PostDataForThemePage
- type TemplateData
- type TextClassification
- type Thread
- type ThreadDataForMainPage
- type User
- type Validatable
- type ValidationConfig
- type Votes
Constants ¶
This section is empty.
Variables ¶
var Classifications = []TextClassification{"irrelevant",
"obscene",
"illegal",
"insulting",
"unsorted",
"approved",
}
Functions ¶
func ValidateLength ¶
ValidateLength checks if the length of the field is within the specified range.
func ValidateRequired ¶
ValidateRequired checks if the field is required and not empty.
Types ¶
type PM ¶
type PM struct { ID int Content string Created time.Time SenderUserID int ReceiverUserID int SenderName string ReceiverName string }
func (*PM) ValidatePM ¶
func (pm *PM) ValidatePM(config ValidationConfig) []error
type Post ¶
type Post struct { ID int Subject string Content string Created time.Time ThreadId int UserID int Image string Classification string }
func (*Post) Validate ¶
func (post *Post) Validate(config ValidationConfig) []error
Validate performs validation on the thread struct. It checks for the presence of required fields and validates the length format. Returns a slice of errors, where each error represents a validation issue.
type PostDataForThemePage ¶
type TemplateData ¶
type TextClassification ¶
type TextClassification string
CommentType represents the type of a comment
type Thread ¶
type Thread struct { ID int Subject string Created time.Time UserID int Image string Category string Classification string }
func (*Thread) Validate ¶
func (thread *Thread) Validate(config ValidationConfig) []error
Validate performs validation on the thread struct. It checks for the presence of required fields and validates the length format. Returns a slice of errors, where each error represents a validation issue.
type ThreadDataForMainPage ¶
type User ¶
type User struct { ID int UserName string Password string FirstName string LastName string Email string Created time.Time Picture string LastActivity time.Time Type string }
func (*User) Validate ¶
func (u *User) Validate(config ValidationConfig) []error
Validate performs validation on the User struct. It checks for the presence of required fields and validates the email format. Returns a slice of errors, where each error represents a validation issue.
type Validatable ¶
type Validatable interface {
Validate() []error
}