mirror of
https://github.com/3ybactuk/marketplace-go-service-project.git
synced 2025-10-30 05:53:45 +03:00
23 lines
393 B
Go
23 lines
393 B
Go
package model
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
type Comment struct {
|
|
ID int64 `validate:"gt=0"`
|
|
UserID int64 `validate:"gt=0"`
|
|
SKU int64 `validate:"gt=0"`
|
|
CreatedAt time.Time
|
|
Text string `validate:"lte=255,gt=0"`
|
|
}
|
|
|
|
func (c *Comment) Validate() error {
|
|
if err := validate.Struct(c); err != nil {
|
|
return fmt.Errorf("invalid requested values: %w", err)
|
|
}
|
|
|
|
return nil
|
|
}
|