2022-01-08 16:21:53 +00:00
|
|
|
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
|
2022-01-08 16:21:53 +00:00
|
|
|
}
|
|
|
|
val2, err2 := strconv.Atoi(val1)
|
|
|
|
if err2 != nil {
|
2022-01-09 14:14:19 +00:00
|
|
|
return 0
|
2022-01-08 16:21:53 +00:00
|
|
|
}
|
|
|
|
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
|
2022-01-08 16:21:53 +00:00
|
|
|
}
|
|
|
|
val2, err2 := strconv.Atoi(val1)
|
|
|
|
if err2 != nil {
|
2022-01-09 14:14:19 +00:00
|
|
|
return 0
|
2022-01-08 16:21:53 +00:00
|
|
|
}
|
|
|
|
return val2
|
|
|
|
}
|