MM-21118: Use querybuilder instead of fmt.Sprintf in channelStore (#13385)

* MM-21118: Use querybuilder instead of fmt.Sprintf in channelStore

We use the querybuilder API instead of just building the query string
manually using fmt.Sprintf

* Replaced comma with colon
Этот коммит содержится в:
Agniva De Sarker
2019-12-17 22:33:38 +05:30
коммит произвёл Jesús Espino
родитель de0672937c
Коммит 0e6f0cfbd6

Просмотреть файл

@@ -960,7 +960,7 @@ func (s SqlChannelStore) getAllChannelsQuery(opts store.ChannelSearchOpts, forCo
}
if len(opts.ExcludeChannelNames) > 0 {
query = query.Where(fmt.Sprintf("c.Name NOT IN ('%s')", strings.Join(opts.ExcludeChannelNames, "', '")))
query = query.Where(sq.NotEq{"c.Name": opts.ExcludeChannelNames})
}
return query
@@ -2265,7 +2265,7 @@ func (s SqlChannelStore) channelSearchQuery(term string, opts store.ChannelSearc
}
if len(opts.ExcludeChannelNames) > 0 {
query = query.Where(fmt.Sprintf("c.Name NOT IN ('%s')", strings.Join(opts.ExcludeChannelNames, "', '")))
query = query.Where(sq.NotEq{"c.Name": opts.ExcludeChannelNames})
}
if len(opts.NotAssociatedToGroup) > 0 {