goshorly/db/GetStats.go
2022-01-13 20:06:30 +01:00

29 lines
426 B
Go

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