mirror of
https://github.com/3ybactuk/marketplace-go-service-project.git
synced 2025-10-30 14:03:45 +03:00
22 lines
319 B
Go
22 lines
319 B
Go
package model
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"route256/cart/internal/domain/entity"
|
|
)
|
|
|
|
type Product struct {
|
|
Name string
|
|
Price int32
|
|
Sku entity.Sku `validate:"gt=0"`
|
|
}
|
|
|
|
func (p *Product) Validate() error {
|
|
if err := validate.Struct(p); err != nil {
|
|
return fmt.Errorf("invalid requested values: %w", err)
|
|
}
|
|
|
|
return nil
|
|
}
|