Return artist indexes in lexigraphical order.

This commit is contained in:
EdwardDowling
2019-06-01 15:59:42 +01:00
parent e60da75422
commit c6ca1a1475
3 changed files with 7 additions and 0 deletions

1
go.mod
View File

@@ -2,6 +2,7 @@ module github.com/sentriz/gonic
require (
cloud.google.com/go v0.37.1 // indirect
github.com/aclements/go-gg v0.0.0-20170323211221-abd1f791f5ee
github.com/denisenkom/go-mssqldb v0.0.0-20190315220205-a8ed825ac853 // indirect
github.com/dhowden/tag v0.0.0-20181104225729-a9f04c2798ca
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 // indirect

2
go.sum
View File

@@ -7,6 +7,8 @@ git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGy
git.apache.org/thrift.git v0.12.0/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/aclements/go-gg v0.0.0-20170323211221-abd1f791f5ee h1:KJgh99JlYRhfgHtb7XyhAZSJMdfkjVmo3PP7XO1/HO8=
github.com/aclements/go-gg v0.0.0-20170323211221-abd1f791f5ee/go.mod h1:55qNq4vcpkIuHowELi5C8e+1yUHtoLoOUR9QU5j7Tes=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=

View File

@@ -3,6 +3,7 @@ package handler
import (
"fmt"
"net/http"
"sort"
"strings"
"github.com/jinzhu/gorm"
@@ -30,6 +31,9 @@ func (c *Controller) GetArtists(w http.ResponseWriter, r *http.Request) {
index.Artists = append(index.Artists,
makeArtistFromArtist(&artist))
}
sort.Slice(indexes.List[:], func(i, j int) bool {
return indexes.List[i].Name < indexes.List[j].Name
})
sub := subsonic.NewResponse()
sub.Artists = &indexes
respond(w, r, sub)