plausible

package
v0.0.0-...-68a93bb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PropertyPeriodSevenDay  = "7d"
	PropertyPeriodThirtyDay = "30d"
	PropertyPeriodSixMo     = "6mo"
	PropertyPeriodTwelveMo  = "12mo"
	PropertyPeriodMonth     = "month"
	PropertyPeridoDay       = "day"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregate

type Aggregate struct {
	BounceRate    Valuer `json:"bounce_rage"`
	PageViews     Valuer `json:"pageviews"`
	VisitDuration Valuer `json:"visit_duration"`
	Visitors      Valuer `json:"visitors"`
}

type DaySnapshot

type DaySnapshot struct {
	Date     PlausibletTime `json:"date"`
	Visitors int            `json:"visitors"`
}

type Page

type Page struct {
	Page     string `json:"page"`
	Visitors int    `json:"visitors"`
}

type PlausibletTime

type PlausibletTime time.Time

func (PlausibletTime) MarshalJSON

func (t PlausibletTime) MarshalJSON() ([]byte, error)

func (*PlausibletTime) UnmarshalJSON

func (t *PlausibletTime) UnmarshalJSON(b []byte) error

type Results

type Results[T any] struct {
	Results T `json:"results"`
}

type SiteTokenPair

type SiteTokenPair struct {
	SiteID  string
	Token   string
	Favicon string
}

func NewSiteTokenPair

func NewSiteTokenPair(siteID, token string) SiteTokenPair

type Source

type Source struct {
	Source   string `json:"source"`
	Visitors int    `json:"visitors"`
}

type StatsRepo

type StatsRepo interface {
	LoadTopSources(period string) ([]Source, error)
	LoadTopPages(period string) ([]Page, error)
	LoadTimeSeries(period string) ([]DaySnapshot, error)
	LoadAggregate(period string) (Aggregate, error)
	LoadRealtime() (int, error)
}

func NewStatsRepoResty

func NewStatsRepoResty(pair SiteTokenPair) StatsRepo

type StatsRepoResty

type StatsRepoResty struct {
	// contains filtered or unexported fields
}

func (*StatsRepoResty) LoadAggregate

func (r *StatsRepoResty) LoadAggregate(period string) (Aggregate, error)

func (*StatsRepoResty) LoadRealtime

func (r *StatsRepoResty) LoadRealtime() (int, error)

func (*StatsRepoResty) LoadTimeSeries

func (r *StatsRepoResty) LoadTimeSeries(period string) ([]DaySnapshot, error)

func (*StatsRepoResty) LoadTopPages

func (r *StatsRepoResty) LoadTopPages(period string) ([]Page, error)

func (*StatsRepoResty) LoadTopSources

func (r *StatsRepoResty) LoadTopSources(period string) ([]Source, error)

type Valuer

type Valuer struct {
	Value float64 `json:"value"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL