Scanning artists and albums too

This commit is contained in:
Deluan
2016-02-28 13:50:05 -05:00
parent bccfeec2d3
commit 14e52576a7
11 changed files with 209 additions and 51 deletions
+14 -4
View File
@@ -1,18 +1,28 @@
package repositories
import (
"fmt"
"crypto/md5"
"strings"
)
type BaseRepository struct {
key string
key string // TODO Rename to 'table'
}
func (r *BaseRepository) saveOrUpdate(id string, rec interface{}) error {
return saveStruct(r.key, id, rec)
func (r *BaseRepository) NewId(fields ...string) string {
s := fmt.Sprintf("%s\\%s", strings.ToUpper(r.key), strings.Join(fields, ""))
return fmt.Sprintf("%x", md5.Sum([]byte(s)))
}
func (r *BaseRepository) CountAll() (int, error) {
return count(r.key)
}
func (r *BaseRepository) saveOrUpdate(id string, rec interface{}) error {
return saveStruct(r.key, id, rec)
}
func (r *BaseRepository) Dump() {
}