goshorly/db/GetStats.go

30 lines
426 B
Go
Raw Normal View History

package db
import (
"strconv"
)
func GetTotalLinks() int {
2022-01-13 19:06:30 +00:00
val1, err1 := Client.Get(ctx, "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 {
2022-01-13 19:06:30 +00:00
val1, err1 := Client.Get(ctx, "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
}