added CategoryProvider and CategoryData with some basic interface methods but no implementation yet

This commit is contained in:
Philipp Häfelfinger 2019-04-02 23:26:25 +02:00
parent 710b76c79f
commit 0e5fcaf525

View File

@ -16,6 +16,18 @@ import (
var ErrorRecordNotFound = errors.New("Record not found") var ErrorRecordNotFound = errors.New("Record not found")
type CategoryData struct {
CategoryId int
PiwigoId int
PiwigoParentId int
Name string
Key string
}
func (cat *CategoryData) String() string {
return fmt.Sprintf("CategoryData{CategoryId:%d, PiwigoId:%d, PiwigoParentId:%d, Name:%s, Key:%s}", cat.CategoryId, cat.PiwigoId, cat.PiwigoParentId, cat.Name, cat.Key)
}
type ImageMetaData struct { type ImageMetaData struct {
ImageId int ImageId int
PiwigoId int PiwigoId int
@ -33,6 +45,12 @@ func (img *ImageMetaData) String() string {
return fmt.Sprintf("ImageMetaData{ImageId:%d, PiwigoId:%d, CategoryId:%d, RelPath:%s, File:%s, Md5:%s, Change:%sS, catpath:%s, UploadRequired: %t, DeleteRequired: %t}", img.ImageId, img.PiwigoId, img.CategoryId, img.FullImagePath, img.Filename, img.Md5Sum, img.LastChange.String(), img.CategoryPath, img.UploadRequired, img.DeleteRequired) return fmt.Sprintf("ImageMetaData{ImageId:%d, PiwigoId:%d, CategoryId:%d, RelPath:%s, File:%s, Md5:%s, Change:%sS, catpath:%s, UploadRequired: %t, DeleteRequired: %t}", img.ImageId, img.PiwigoId, img.CategoryId, img.FullImagePath, img.Filename, img.Md5Sum, img.LastChange.String(), img.CategoryPath, img.UploadRequired, img.DeleteRequired)
} }
type CategoryProvider interface {
SaveCategory(category CategoryData) error
GetCategoryByPiwigoId(id int) (CategoryData, error)
GetCategoryByKey(key string) (CategoryData, error)
}
type ImageMetadataProvider interface { type ImageMetadataProvider interface {
ImageMetadata(fullImagePath string) (ImageMetaData, error) ImageMetadata(fullImagePath string) (ImageMetaData, error)
ImageMetadataToUpload() ([]ImageMetaData, error) ImageMetadataToUpload() ([]ImageMetaData, error)