🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Mark helper function as unexported
Deluandbde5330bddb
diff --git a/persistence/album_repository.go b/persistence/album_repository.goindex e9c666938..eb7e99591 100644--- a/persistence/album_repository.go+++ b/persistence/album_repository.go@@ -51,7 +51,7 @@ func yearFilter(field string, value interface{}) Sqlizer {}func artistFilter(field string, value interface{}) Sqlizer {- return Exists("media_file", And{+ return exists("media_file", And{ConcatExpr("album_id=album.id"),Or{Eq{"artist_id": value},diff --git a/persistence/helpers.go b/persistence/helpers.goindex 7746b36ce..70a611dd7 100644--- a/persistence/helpers.go+++ b/persistence/helpers.go@@ -39,16 +39,16 @@ func toSnakeCase(str string) string {return strings.ToLower(snake)}-func Exists(subTable string, cond squirrel.Sqlizer) exists {- return exists{subTable: subTable, cond: cond}+func exists(subTable string, cond squirrel.Sqlizer) existsCond {+ return existsCond{subTable: subTable, cond: cond}}-type exists struct {+type existsCond struct {subTable stringcond squirrel.Sqlizer}-func (e exists) ToSql() (string, []interface{}, error) {+func (e existsCond) ToSql() (string, []interface{}, error) {sql, args, err := e.cond.ToSql()sql = fmt.Sprintf("exists (select 1 from %s where %s)", e.subTable, sql)return sql, args, errdiff --git a/persistence/helpers_test.go b/persistence/helpers_test.goindex fdc636aeb..dbecce12b 100644--- a/persistence/helpers_test.go+++ b/persistence/helpers_test.go@@ -9,7 +9,7 @@ import (var _ = Describe("Helpers", func() {Describe("Exists", func() {It("constructs the correct EXISTS query", func() {- e := Exists("album", squirrel.Eq{"id": 1})+ e := exists("album", squirrel.Eq{"id": 1})sql, args, err := e.ToSql()Expect(sql).To(Equal("exists (select 1 from album where id = ?)"))Expect(args).To(Equal([]interface{}{1}))