MCPcopy
hub / github.com/usefathom/fathom / GetSiteStats

Method GetSiteStats

pkg/datastore/sqlstore/site_stats.go:11–21  ·  view source on GitHub ↗
(siteID int64, date time.Time)

Source from the content-addressed store, hash-verified

9)
10
11func (db *sqlstore) GetSiteStats(siteID int64, date time.Time) (*models.SiteStats, error) {
12 stats := &models.SiteStats{New: false}
13 query := db.Rebind(`SELECT * FROM site_stats WHERE site_id = ? AND ts = ? LIMIT 1`)
14
15 err := db.Get(stats, query, siteID, date.Format(DATE_FORMAT))
16 if err == sql.ErrNoRows {
17 return nil, ErrNoResults
18 }
19
20 return stats, mapError(err)
21}
22
23func (db *sqlstore) SaveSiteStats(s *models.SiteStats) error {
24 if s.New {

Callers

nothing calls this directly

Calls 1

mapErrorFunction · 0.85

Tested by

no test coverage detected