Scanning artists and albums too
This commit is contained in:
@@ -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() {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user