goshorly/db/GetStats.go

30 lines
442 B
Go
Raw Normal View History

package db
import (
"strconv"
)
func GetTotalLinks() int {
2022-01-25 18:14:09 +00:00
val1, err1 := Client_redis().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-25 18:14:09 +00:00
val1, err1 := Client_redis().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
}