This commit is contained in:
+2
-2
@@ -221,8 +221,8 @@ func (m *MySQL) UpdateBook(ctx context.Context, old, new *media.Book) error {
|
||||
res, err := m.connection.ExecContext(ctx, `
|
||||
UPDATE `+m.tableName+`
|
||||
SET
|
||||
id=? title=? authors=? sortauthor=? isbn10=? isbn13=? format=? genre=? publisher=?
|
||||
series=? volume=? year=? signed=? description=? notes=? coverurl=? childrens=?
|
||||
title=?, authors=?, sortauthor=?, isbn10=?, isbn13=?, format=?, genre=?, publisher=?,
|
||||
series=?, volume=?, year=?, signed=?, description=?, notes=?, coverurl=?, childrens=?
|
||||
WHERE id=?`,
|
||||
new.Title, strings.Join(new.Authors, ";"), new.SortAuthor, new.ISBN10, new.ISBN13, new.Format, new.Genre, new.Publisher,
|
||||
new.Series, new.Volume, new.Year, new.Signed, new.Description, new.Notes, new.CoverURL, new.Childrens, old.ID,
|
||||
|
||||
@@ -100,6 +100,7 @@ func (c *DiscogsCache) loadRecordsFromFS(ctx context.Context) ([]media.Record, t
|
||||
if err != nil {
|
||||
return nil, time.Time{}, fmt.Errorf("error opening cache file %s: %w", c.persistFile, err)
|
||||
}
|
||||
defer f.Close()
|
||||
err = gob.NewDecoder(f).Decode(p)
|
||||
if err != nil {
|
||||
return nil, time.Time{}, fmt.Errorf("error readhing from cache file %s: %w", c.persistFile, err)
|
||||
@@ -120,6 +121,7 @@ func (c *DiscogsCache) saveRecordsToCache(ctx context.Context, records []media.R
|
||||
if err != nil {
|
||||
return fmt.Errorf("error opening cache file %s: %w", c.persistFile, err)
|
||||
}
|
||||
defer f.Close()
|
||||
err = gob.NewEncoder(f).Encode(p)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error writing to cache file %s: %w", c.persistFile, err)
|
||||
|
||||
@@ -39,8 +39,8 @@ func getPublisher(publishers []client.Publishers) string {
|
||||
|
||||
func getAuthors(authors []client.Authors) []string {
|
||||
ret := make([]string, len(authors))
|
||||
for _, author := range authors {
|
||||
ret = append(ret, author.Name)
|
||||
for i, author := range authors {
|
||||
ret[i] = author.Name
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user