Versions in this module Expand all Collapse all v0 v0.19.0 Nov 3, 2026 Changes in this version + const BeaconPath + const BufferCap + const CronRollup + const DBFile + const DimBrowser + const DimCountry + const DimDevice + const DimForm + const DimOS + const DimPage + const DimRef + const DimTotal + const DimUTM + const FlushBatch + const FlushEvery + const GeoFile + const InsertBatch + const KindSubmit + const KindView + const ModuleName + const PermView + const ScriptPath + const SettingBackupExclude + const SettingEnabled + const SettingExclude + var ErrClosed = errors.New("analytics: store closed") + var ErrDim = errors.New("analytics: unknown dim") + var ErrRange = errors.New("analytics: empty or invalid range") + type Buffer struct + func NewBuffer(s *Store, cap int, every time.Duration, batch int, log *slog.Logger) *Buffer + func (b *Buffer) Add(e Event) bool + func (b *Buffer) Flush(ctx context.Context) error + func (b *Buffer) Len() int + func (b *Buffer) Run(ctx context.Context) + type Event struct + Browser string + Country string + Device string + Form string + Kind string + Locale string + OS string + Path string + RefHost string + TS time.Time + UTMCampaign string + UTMMedium string + UTMSource string + Visitor string + type Filter struct + Country string + Device string + From time.Time + Page string + Ref string + To time.Time + type FormRow struct + Form string + Page string + Rate float64 + Submits int + Views int + type Module struct + func New() *Module + func (*Module) Catalogs() fs.FS + func (*Module) Enabled(ctx context.Context, d *sql.DB) (bool, error) + func (*Module) Migrations() fs.FS + func (*Module) Name() string + func (m *Module) Register(d *kernel.Deps) error + type Point struct + At time.Time + Views int + Visitors int + type PointJSON struct + At time.Time + Views int + Visitors int + type Row struct + Key string + Views int + Visitors int + type RowJSON struct + Key string + Views int + Visitors int + type Store struct + func OpenStore(dataDir string) (*Store, error) + func (s *Store) Close() error + func (s *Store) DB() *sql.DB + func (s *Store) DeleteAll(ctx context.Context) (deleted, error) + func (s *Store) DeleteBefore(ctx context.Context, day time.Time) (deleted, error) + func (s *Store) Forms(ctx context.Context, f Filter) ([]FormRow, error) + func (s *Store) Insert(ctx context.Context, evs []Event) error + func (s *Store) Now(ctx context.Context, at time.Time) (int, error) + func (s *Store) Path() string + func (s *Store) Reopen() error + func (s *Store) Rollup(ctx context.Context, now time.Time) error + func (s *Store) Series(ctx context.Context, f Filter) ([]Point, error) + func (s *Store) Summary(ctx context.Context, f Filter) (Summary, error) + func (s *Store) Top(ctx context.Context, f Filter, dim string, limit int) ([]Row, error) + func (s *Store) VisitorHash(ctx context.Context, day time.Time, siteID, ip, ua string) (string, error) + func (s *Store) With(ctx context.Context, fn func(*sql.DB) error) error + type Summary struct + Prev *Summary + Submits int + Views int + ViewsPerVisitor float64 + Visitors int + type SummaryJSON struct + Prev *SummaryJSON + Submits int + Views int + ViewsPerVisitor float64 + Visitors int + type SummaryResponse struct + From time.Time + Series []PointJSON + Summary SummaryJSON + To time.Time + Top map[string][]RowJSON