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