BlogBackend/internal/domain/entities/images.go
2025-09-16 13:26:27 +04:00

33 lines
437 B
Go

package entities
import (
"errors"
"github.com/google/uuid"
)
const ImagesTable = "images"
type Images struct {
Id uuid.UUID `db:"id"`
Path string `db:"path"`
}
func CreateImage(path string) (image Images, err error) {
image = Images{
Id: uuid.New(),
Path: path,
}
err = image.Validate()
return
}
func (i *Images) Validate() error {
if i.Path == "" {
return errors.New("Empty image.path")
}
return nil
}