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

Method GetReferrerStats

pkg/datastore/sqlstore/referrer_stats.go:10–19  ·  view source on GitHub ↗
(siteID int64, date time.Time, hostnameID int64, pathnameID int64)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

mapErrorFunction · 0.85

Tested by

no test coverage detected