stats.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright (c) [2022] [巴拉迪维 BaratSemet]
  2. // [ohUrlShortener] is licensed under Mulan PSL v2.
  3. // You can use this software according to the terms and conditions of the Mulan PSL v2.
  4. // You may obtain a copy of Mulan PSL v2 at:
  5. // http://license.coscl.org.cn/MulanPSL2
  6. // THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  7. // See the Mulan PSL v2 for more details.
  8. package core
  9. // ShortUrlStats 短链接统计
  10. type ShortUrlStats struct {
  11. ShortUrl string `db:"short_url" json:"short_url"`
  12. TodayCount int `db:"today_count" json:"today_count"`
  13. YesterdayCount int `db:"yesterday_count" json:"yesterday_count"`
  14. Last7DaysCount int `db:"last_7_days_count" json:"last_7_days_count"`
  15. MonthlyCount int `db:"monthly_count" json:"monthly_count"`
  16. TotalCount int `db:"total_count" json:"total_count"`
  17. DistinctTodayCount int `db:"d_today_count" json:"d_today_count"`
  18. DistinctYesterdayCount int `db:"d_yesterday_count" json:"d_yesterday_count"`
  19. DistinctLast7DaysCount int `db:"d_last_7_days_count" json:"d_last_7_days_count"`
  20. DistinctMonthlyCount int `db:"d_monthly_count" json:"d_monthly_count"`
  21. DistinctTotalCount int `db:"d_total_count" json:"d_total_count"`
  22. }
  23. // Top25Url 短链接统计
  24. type Top25Url struct {
  25. ShortUrl
  26. ShortUrlStats
  27. }
  28. // UrlIpCountStats 短链接统计
  29. type UrlIpCountStats struct {
  30. ShortUrl
  31. ShortUrlStats
  32. }
  33. // StatsSum 短链接统计
  34. type StatsSum struct {
  35. Key string `db:"stats_key"`
  36. Value int `db:"stats_value"`
  37. }