build spotify-to-navidrome migrator with recovery flow
This commit is contained in:
24
internal/report/report.go
Normal file
24
internal/report/report.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package report
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"navimigrate/internal/model"
|
||||
)
|
||||
|
||||
func Write(path string, rep model.TransferReport) error {
|
||||
f, err := os.Create(path)
|
||||
if err != nil {
|
||||
return fmt.Errorf("create report file: %w", err)
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
enc := json.NewEncoder(f)
|
||||
enc.SetIndent("", " ")
|
||||
if err := enc.Encode(rep); err != nil {
|
||||
return fmt.Errorf("encode report: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user