Renamed methods as GO has no Getter or Setter

This commit is contained in:
Philipp Häfelfinger 2019-03-19 21:19:38 +01:00
parent 5166b0c6b8
commit 00404788cb
4 changed files with 11 additions and 11 deletions

View File

@ -28,8 +28,8 @@ func (img *ImageMetaData) String() string {
}
type ImageMetadataProvider interface {
GetImageMetadata(relativePath string) (ImageMetaData, error)
GetImageMetadataToUpload() ([]*ImageMetaData, error)
ImageMetadata(relativePath string) (ImageMetaData, error)
ImageMetadataToUpload() ([]*ImageMetaData, error)
SaveImageMetadata(m ImageMetaData) error
}
@ -55,7 +55,7 @@ func (d *localDataStore) Initialize(connectionString string) error {
return err
}
func (d *localDataStore) GetImageMetadata(relativePath string) (ImageMetaData, error) {
func (d *localDataStore) ImageMetadata(relativePath string) (ImageMetaData, error) {
logrus.Tracef("Query image metadata for file %s", relativePath)
img := ImageMetaData{}
@ -89,7 +89,7 @@ func (d *localDataStore) GetImageMetadata(relativePath string) (ImageMetaData, e
return img, err
}
func (d *localDataStore) GetImageMetadataToUpload() ([]*ImageMetaData, error) {
func (d *localDataStore) ImageMetadataToUpload() ([]*ImageMetaData, error) {
logrus.Tracef("Query all image metadata that represent files queued to upload")
db, err := d.openDatabase()

View File

@ -52,7 +52,7 @@ func TestSaveAndQueryForUploadRecords(t *testing.T) {
saveImageShouldNotFail("toupload", dataStore, img, t)
img.ImageId = 1
images, err := dataStore.GetImageMetadataToUpload()
images, err := dataStore.ImageMetadataToUpload()
if err != nil {
t.Fatalf("Could not query images to upload! %s", err)
}
@ -74,7 +74,7 @@ func TestLoadMetadataNotFound(t *testing.T) {
dataStore := setupDatabase(t)
filePath := "blah/foo/bar.jpg"
imgLoad, err := dataStore.GetImageMetadata(filePath)
imgLoad, err := dataStore.ImageMetadata(filePath)
if err != ErrorRecordNotFound {
t.Errorf("Unexpected error on loading non existing file %s: %s", filePath, err)
}
@ -118,7 +118,7 @@ func saveImageShouldNotFail(action string, dataStore *localDataStore, img ImageM
}
func loadMetadataShouldNotFail(action string, dataStore *localDataStore, filePath string, t *testing.T) ImageMetaData {
imgLoad, err := dataStore.GetImageMetadata(filePath)
imgLoad, err := dataStore.ImageMetadata(filePath)
if err != nil {
t.Errorf("%s: Could not load saved Metadata: %s - %s", action, filePath, err)
}

View File

@ -29,7 +29,7 @@ func synchronizeLocalImageMetadata(metadataStorage ImageMetadataProvider, fileSy
continue
}
metadata, err := metadataStorage.GetImageMetadata(file.Key)
metadata, err := metadataStorage.ImageMetadata(file.Key)
if err == ErrorRecordNotFound {
logrus.Debugf("No metadata for %s found. Creating new entry.", file.Key)
metadata = ImageMetaData{}
@ -73,7 +73,7 @@ func synchronizePiwigoMetadata(piwigo *piwigo.PiwigoContext, metadataStorage Ima
// - check if category has to be assigned (image possibly added to two albums -> only uploaded once but assigned multiple times) -> implement later
logrus.Debugf("Starting synchronizePiwigoMetadata")
images, err := metadataStorage.GetImageMetadataToUpload()
images, err := metadataStorage.ImageMetadataToUpload()
if err != nil {
return err
}

View File

@ -189,7 +189,7 @@ func NewtestStore() *testStore {
return &testStore{savedMetadata: make(map[string]ImageMetaData)}
}
func (s *testStore) GetImageMetadata(relativePath string) (ImageMetaData, error) {
func (s *testStore) ImageMetadata(relativePath string) (ImageMetaData, error) {
metadata, exist := s.savedMetadata[relativePath]
if !exist {
return ImageMetaData{}, ErrorRecordNotFound
@ -202,7 +202,7 @@ func (s *testStore) SaveImageMetadata(m ImageMetaData) error {
return nil
}
func (d *testStore) GetImageMetadataToUpload() ([]*ImageMetaData, error) {
func (d *testStore) ImageMetadataToUpload() ([]*ImageMetaData, error) {
return nil, errors.New("N/A")
}