goshorly/db/GetStats.go
2022-01-25 19:14:09 +01:00

29 lines
442 B
Go

package db
import (
"strconv"
)
func GetTotalLinks() int {
val1, err1 := Client_redis().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_redis().Get(ctx, "total-views").Result()
if err1 != nil {
return 0
}
val2, err2 := strconv.Atoi(val1)
if err2 != nil {
return 0
}
return val2
}