Clean up methods

This commit is contained in:
idanoo 2023-01-30 11:57:55 +13:00
parent a2a5a26e0f
commit dcbef8eb1f
Signed by: idanoo
GPG key ID: 387387CDBC02F132
3 changed files with 8 additions and 1 deletions

1
go.mod
View file

@ -8,4 +8,5 @@ require (
github.com/lib/pq v1.10.7 // indirect github.com/lib/pq v1.10.7 // indirect
github.com/mattn/go-mastodon v0.0.6 // indirect github.com/mattn/go-mastodon v0.0.6 // indirect
github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 // indirect github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 // indirect
golang.org/x/text v0.6.0 // indirect
) )

2
go.sum
View file

@ -8,3 +8,5 @@ github.com/mattn/go-mastodon v0.0.6 h1:lqU1sOeeIapaDsDUL6udDZIzMb2Wqapo347VZlaOz
github.com/mattn/go-mastodon v0.0.6/go.mod h1:cg7RFk2pcUfHZw/IvKe1FUzmlq5KnLFqs7eV2PHplV8= github.com/mattn/go-mastodon v0.0.6/go.mod h1:cg7RFk2pcUfHZw/IvKe1FUzmlq5KnLFqs7eV2PHplV8=
github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 h1:nrZ3ySNYwJbSpD6ce9duiP+QkD3JuLCcWkdaehUS/3Y= github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 h1:nrZ3ySNYwJbSpD6ce9duiP+QkD3JuLCcWkdaehUS/3Y=
github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80/go.mod h1:iFyPdL66DjUD96XmzVL3ZntbzcflLnznH0fr99w5VqE= github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80/go.mod h1:iFyPdL66DjUD96XmzVL3ZntbzcflLnznH0fr99w5VqE=
golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k=
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=

View file

@ -6,6 +6,7 @@ import (
"time" "time"
"golang.org/x/text/cases" "golang.org/x/text/cases"
"golang.org/x/text/language"
) )
// Stores out metric/row data // Stores out metric/row data
@ -116,5 +117,8 @@ func getUserCounts() ([]metric, error) {
} }
func getPrintableString(m metric) string { func getPrintableString(m metric) string {
return fmt.Sprintf("%s: %d", cases.Title(m.Service), m.MetricValue) caser := cases.Title(language.English)
titleStr := caser.String(m.Service)
return fmt.Sprintf("%s: %d", titleStr, m.MetricValue)
} }