Renamed persistence packages

This commit is contained in:
Deluan
2020-01-10 19:41:35 -05:00
committed by Deluan Quintão
parent a1d837cb9b
commit 11f4505925
34 changed files with 85 additions and 85 deletions
@@ -1,4 +1,4 @@
package ledis
package db_ledis
import (
"errors"
@@ -1,4 +1,4 @@
package ledis
package db_ledis
import (
"errors"
@@ -1,4 +1,4 @@
package ledis
package db_ledis
import (
"errors"
@@ -1,4 +1,4 @@
package ledis
package db_ledis
import (
"errors"
@@ -18,11 +18,11 @@ func NewArtistIndexRepository() domain.ArtistIndexRepository {
}
func (r *artistIndexRepository) Put(m *domain.ArtistIndex) error {
if m.Id == "" {
if m.ID == "" {
return errors.New("index ID is not set")
}
sort.Sort(m.Artists)
return r.saveOrUpdate(m.Id, m)
return r.saveOrUpdate(m.ID, m)
}
func (r *artistIndexRepository) Get(id string) (*domain.ArtistIndex, error) {
@@ -40,7 +40,7 @@ func (r *artistIndexRepository) GetAll() (domain.ArtistIndexes, error) {
func (r *artistIndexRepository) DeleteAll() error {
var empty domain.ArtistIndexes
_, err := r.purgeInactive(empty, func(e interface{}) string {
return e.(domain.ArtistIndex).Id
return e.(domain.ArtistIndex).ID
})
return err
@@ -1,4 +1,4 @@
package ledis
package db_ledis
import (
"strconv"
@@ -17,7 +17,7 @@ func TestIndexRepository(t *testing.T) {
repo := NewArtistIndexRepository()
Convey("It should be able to read and write to the database", func() {
i := &domain.ArtistIndex{Id: "123"}
i := &domain.ArtistIndex{ID: "123"}
repo.Put(i)
s, _ := repo.Get("123")
@@ -25,7 +25,7 @@ func TestIndexRepository(t *testing.T) {
So(s, shouldBeEqual, i)
})
Convey("It should be able to check for existence of an ID", func() {
i := &domain.ArtistIndex{Id: "123"}
i := &domain.ArtistIndex{ID: "123"}
repo.Put(i)
@@ -44,7 +44,7 @@ func TestIndexRepository(t *testing.T) {
})
Convey("Given that I have 4 records", func() {
for i := 1; i <= 4; i++ {
e := &domain.ArtistIndex{Id: strconv.Itoa(i)}
e := &domain.ArtistIndex{ID: strconv.Itoa(i)}
repo.Put(e)
}
@@ -58,7 +58,7 @@ func TestIndexRepository(t *testing.T) {
})
Convey("And the values should be retrieved", func() {
for _, e := range indices {
So(e.Id, ShouldBeIn, []string{"1", "2", "3", "4"})
So(e.ID, ShouldBeIn, []string{"1", "2", "3", "4"})
}
})
})
@@ -1,4 +1,4 @@
package ledis
package db_ledis
import (
"sync"
@@ -1,4 +1,4 @@
package ledis
package db_ledis
import (
"crypto/md5"
@@ -1,4 +1,4 @@
package ledis
package db_ledis
import (
"fmt"
@@ -1,4 +1,4 @@
package ledis
package db_ledis
import (
"errors"
@@ -1,4 +1,4 @@
package ledis
package db_ledis
import (
"github.com/cloudsonic/sonic-server/conf"
@@ -1,4 +1,4 @@
package ledis
package db_ledis
import (
"encoding/json"
@@ -1,4 +1,4 @@
package ledis
package db_ledis
import (
"errors"
@@ -1,4 +1,4 @@
package ledis
package db_ledis
import (
"errors"
@@ -1,4 +1,4 @@
package ledis
package db_ledis
import "github.com/google/wire"
@@ -1,4 +1,4 @@
package storm
package db_storm
import (
"time"
@@ -1,4 +1,4 @@
package storm
package db_storm
import (
"github.com/cloudsonic/sonic-server/domain"
@@ -1,4 +1,4 @@
package storm
package db_storm
import (
"github.com/cloudsonic/sonic-server/domain"
@@ -1,4 +1,4 @@
package storm
package db_storm
import (
"github.com/cloudsonic/sonic-server/domain"
@@ -1,11 +1,11 @@
package storm
package db_storm
import (
"github.com/cloudsonic/sonic-server/domain"
)
type _ArtistIndex struct {
Id string
ID string
Artists domain.ArtistInfos
}
@@ -1,4 +1,4 @@
package storm
package db_storm
import (
"time"
@@ -1,4 +1,4 @@
package storm
package db_storm
import (
"github.com/asdine/storm"
@@ -1,4 +1,4 @@
package storm
package db_storm
import (
"github.com/cloudsonic/sonic-server/domain"
@@ -1,4 +1,4 @@
package storm
package db_storm
import (
"sync"
@@ -1,4 +1,4 @@
package storm
package db_storm
import (
"reflect"
@@ -1,4 +1,4 @@
package storm
package db_storm
import (
"testing"
@@ -1,4 +1,4 @@
package storm
package db_storm
import "github.com/google/wire"