Initial commit
This commit is contained in:
commit
c0cb826917
63 changed files with 2069 additions and 0 deletions
33
internal/domain/entities/images.go
Normal file
33
internal/domain/entities/images.go
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue