goshorly/db/GetStats.go

30 lines
416 B
Go
Raw Normal View History

package db
import (
"strconv"
)
func GetTotalLinks() int {
val1, err1 := Client.Get("total-links").Result()
if err1 != nil {
2022-01-09 14:14:19 +00:00
return 0
}
val2, err2 := strconv.Atoi(val1)
if err2 != nil {
2022-01-09 14:14:19 +00:00
return 0
}
return val2
}
func GetTotalViews() int {
val1, err1 := Client.Get("total-views").Result()
if err1 != nil {
2022-01-09 14:14:19 +00:00
return 0
}
val2, err2 := strconv.Atoi(val1)
if err2 != nil {
2022-01-09 14:14:19 +00:00
return 0
}
return val2
}