widgets

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: EUPL-1.2, ISC, MIT, + 1 more Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FilterInternal zint.Bitflag8 = 0b0001
)

Functions

This section is empty.

Types

type Args

type Args struct {
	Rng         ztime.Range
	Offset      int
	PathFilter  []int64
	Daily       bool
	ForcedDaily bool
	ShowRefs    int64
}

type Browsers

type Browsers struct {
	Limit  int
	Detail string
	Stats  goatcounter.HitStats
	// contains filtered or unexported fields
}

func (Browsers) Err

func (w Browsers) Err() error

func (*Browsers) GetData

func (w *Browsers) GetData(ctx context.Context, a Args) (more bool, err error)

func (Browsers) HTML

func (w Browsers) HTML() template.HTML

func (Browsers) ID added in v2.2.0

func (w Browsers) ID() int

func (Browsers) Label

func (w Browsers) Label(ctx context.Context) string

func (Browsers) Name

func (w Browsers) Name() string

func (Browsers) RenderHTML

func (w Browsers) RenderHTML(ctx context.Context, shared SharedData) (string, any)

func (*Browsers) SetErr

func (w *Browsers) SetErr(h error)

func (*Browsers) SetHTML

func (w *Browsers) SetHTML(h template.HTML)

func (*Browsers) SetSettings

func (w *Browsers) SetSettings(s goatcounter.WidgetSettings)

func (Browsers) Settings

func (w Browsers) Settings() goatcounter.WidgetSettings

func (Browsers) Type

func (w Browsers) Type() string

type Campaigns added in v2.3.0

type Campaigns struct {
	Limit    int
	Campaign int64
	Stats    goatcounter.HitStats
	// contains filtered or unexported fields
}

func (Campaigns) Err added in v2.3.0

func (w Campaigns) Err() error

func (*Campaigns) GetData added in v2.3.0

func (w *Campaigns) GetData(ctx context.Context, a Args) (more bool, err error)

func (Campaigns) HTML added in v2.3.0

func (w Campaigns) HTML() template.HTML

func (Campaigns) ID added in v2.3.0

func (w Campaigns) ID() int

func (Campaigns) Label added in v2.3.0

func (w Campaigns) Label(ctx context.Context) string

func (Campaigns) Name added in v2.3.0

func (w Campaigns) Name() string

func (Campaigns) RenderHTML added in v2.3.0

func (w Campaigns) RenderHTML(ctx context.Context, shared SharedData) (string, any)

func (*Campaigns) SetErr added in v2.3.0

func (w *Campaigns) SetErr(h error)

func (*Campaigns) SetHTML added in v2.3.0

func (w *Campaigns) SetHTML(h template.HTML)

func (*Campaigns) SetSettings added in v2.3.0

func (w *Campaigns) SetSettings(s goatcounter.WidgetSettings)

func (Campaigns) Settings added in v2.3.0

func (w Campaigns) Settings() goatcounter.WidgetSettings

func (Campaigns) Type added in v2.3.0

func (w Campaigns) Type() string

type Dummy added in v2.3.0

type Dummy struct {
}

func (Dummy) Err added in v2.3.0

func (w Dummy) Err() error

func (*Dummy) GetData added in v2.3.0

func (w *Dummy) GetData(ctx context.Context, a Args) (more bool, err error)

func (Dummy) HTML added in v2.3.0

func (w Dummy) HTML() template.HTML

func (Dummy) ID added in v2.3.0

func (w Dummy) ID() int

func (Dummy) Label added in v2.3.0

func (w Dummy) Label(ctx context.Context) string

func (Dummy) Name added in v2.3.0

func (w Dummy) Name() string

func (Dummy) RenderHTML added in v2.3.0

func (w Dummy) RenderHTML(context.Context, SharedData) (string, any)

func (*Dummy) SetErr added in v2.3.0

func (w *Dummy) SetErr(h error)

func (*Dummy) SetHTML added in v2.3.0

func (w *Dummy) SetHTML(h template.HTML)

func (*Dummy) SetSettings added in v2.3.0

func (w *Dummy) SetSettings(s goatcounter.WidgetSettings)

func (Dummy) Settings added in v2.3.0

func (w Dummy) Settings() goatcounter.WidgetSettings

func (Dummy) Type added in v2.3.0

func (w Dummy) Type() string

type Languages added in v2.2.0

type Languages struct {
	Limit int
	Stats goatcounter.HitStats
	// contains filtered or unexported fields
}

func (Languages) Err added in v2.2.0

func (w Languages) Err() error

func (*Languages) GetData added in v2.2.0

func (w *Languages) GetData(ctx context.Context, a Args) (more bool, err error)

func (Languages) HTML added in v2.2.0

func (w Languages) HTML() template.HTML

func (Languages) ID added in v2.2.0

func (w Languages) ID() int

func (Languages) Label added in v2.2.0

func (w Languages) Label(ctx context.Context) string

func (Languages) Name added in v2.2.0

func (w Languages) Name() string

func (Languages) RenderHTML added in v2.2.0

func (w Languages) RenderHTML(ctx context.Context, shared SharedData) (string, any)

func (*Languages) SetErr added in v2.2.0

func (w *Languages) SetErr(h error)

func (*Languages) SetHTML added in v2.2.0

func (w *Languages) SetHTML(h template.HTML)

func (*Languages) SetSettings added in v2.2.0

func (w *Languages) SetSettings(s goatcounter.WidgetSettings)

func (Languages) Settings added in v2.2.0

func (w Languages) Settings() goatcounter.WidgetSettings

func (Languages) Type added in v2.2.0

func (w Languages) Type() string

type List

type List []Widget

func FromSiteWidgets

func FromSiteWidgets(ctx context.Context, www goatcounter.Widgets, params zint.Bitflag8) List

func ListAllWidgets

func ListAllWidgets() List

ListAllWidgets returns a static list of all widgets that this user can add.

func (List) Get

func (l List) Get(name string) List

Get all widgets from the list by name.

func (List) GetOne added in v2.2.0

func (l List) GetOne(name string) Widget

GetOne gets the first widget in the list by name.

You usually want to use Get()! Only intended to get "internal" widgets where you know it will always have exactly one in the list.

func (List) InitialAndLazy added in v2.2.0

func (l List) InitialAndLazy() (initial List, lazy List)

Initial gets all widgets that should be loaded on the initial pageview (all internal widgets + the first one).

type Locations

type Locations struct {
	Limit  int
	Detail string
	Stats  goatcounter.HitStats
	// contains filtered or unexported fields
}

func (Locations) Err

func (w Locations) Err() error

func (*Locations) GetData

func (w *Locations) GetData(ctx context.Context, a Args) (more bool, err error)

func (Locations) HTML

func (w Locations) HTML() template.HTML

func (Locations) ID added in v2.2.0

func (w Locations) ID() int

func (Locations) Label

func (w Locations) Label(ctx context.Context) string

func (Locations) Name

func (w Locations) Name() string

func (Locations) RenderHTML

func (w Locations) RenderHTML(ctx context.Context, shared SharedData) (string, any)

func (*Locations) SetErr

func (w *Locations) SetErr(h error)

func (*Locations) SetHTML

func (w *Locations) SetHTML(h template.HTML)

func (*Locations) SetSettings

func (w *Locations) SetSettings(s goatcounter.WidgetSettings)

func (Locations) Settings

func (w Locations) Settings() goatcounter.WidgetSettings

func (Locations) Type

func (w Locations) Type() string

type Pages

type Pages struct {
	RefsForPath      int64
	Style            string
	Limit, LimitRefs int
	Display          int
	More             bool
	Pages            goatcounter.HitLists
	Refs             goatcounter.HitStats
	Max              int
	Exclude          []int64
	Diff             []float64
	// contains filtered or unexported fields
}

func (Pages) Err

func (w Pages) Err() error

func (*Pages) GetData

func (w *Pages) GetData(ctx context.Context, a Args) (bool, error)

func (Pages) HTML

func (w Pages) HTML() template.HTML

func (Pages) ID added in v2.2.0

func (w Pages) ID() int

func (Pages) Label

func (w Pages) Label(ctx context.Context) string

func (Pages) Name

func (w Pages) Name() string

func (Pages) RenderHTML

func (w Pages) RenderHTML(ctx context.Context, shared SharedData) (string, any)

func (*Pages) SetErr

func (w *Pages) SetErr(h error)

func (*Pages) SetHTML

func (w *Pages) SetHTML(h template.HTML)

func (*Pages) SetSettings

func (w *Pages) SetSettings(s goatcounter.WidgetSettings)

func (Pages) Settings

func (w Pages) Settings() goatcounter.WidgetSettings

func (Pages) Type

func (w Pages) Type() string

type SharedData

type SharedData struct {
	Site *goatcounter.Site
	User *goatcounter.User
	Args Args

	RowsOnly    bool
	Total       int
	TotalUTC    int
	TotalEvents int
}

SharedData gets passed to every widget.

type Sizes

type Sizes struct {
	Limit  int
	Detail string
	Stats  goatcounter.HitStats
	// contains filtered or unexported fields
}

func (Sizes) Err

func (w Sizes) Err() error

func (*Sizes) GetData

func (w *Sizes) GetData(ctx context.Context, a Args) (more bool, err error)

func (Sizes) HTML

func (w Sizes) HTML() template.HTML

func (Sizes) ID added in v2.2.0

func (w Sizes) ID() int

func (Sizes) Label

func (w Sizes) Label(ctx context.Context) string

func (Sizes) Name

func (w Sizes) Name() string

func (Sizes) RenderHTML

func (w Sizes) RenderHTML(ctx context.Context, shared SharedData) (string, any)

func (*Sizes) SetErr

func (w *Sizes) SetErr(h error)

func (*Sizes) SetHTML

func (w *Sizes) SetHTML(h template.HTML)

func (*Sizes) SetSettings

func (w *Sizes) SetSettings(s goatcounter.WidgetSettings)

func (Sizes) Settings

func (w Sizes) Settings() goatcounter.WidgetSettings

func (Sizes) Type

func (w Sizes) Type() string

type Systems

type Systems struct {
	Limit  int
	Detail string
	Stats  goatcounter.HitStats
	// contains filtered or unexported fields
}

func (Systems) Err

func (w Systems) Err() error

func (*Systems) GetData

func (w *Systems) GetData(ctx context.Context, a Args) (more bool, err error)

func (Systems) HTML

func (w Systems) HTML() template.HTML

func (Systems) ID added in v2.2.0

func (w Systems) ID() int

func (Systems) Label

func (w Systems) Label(ctx context.Context) string

func (Systems) Name

func (w Systems) Name() string

func (Systems) RenderHTML

func (w Systems) RenderHTML(ctx context.Context, shared SharedData) (string, any)

func (*Systems) SetErr

func (w *Systems) SetErr(h error)

func (*Systems) SetHTML

func (w *Systems) SetHTML(h template.HTML)

func (*Systems) SetSettings

func (w *Systems) SetSettings(s goatcounter.WidgetSettings)

func (Systems) Settings

func (w Systems) Settings() goatcounter.WidgetSettings

func (Systems) Type

func (w Systems) Type() string

type TopRefs

type TopRefs struct {
	Limit   int
	Ref     string
	TopRefs goatcounter.HitStats
	// contains filtered or unexported fields
}

func (TopRefs) Err

func (w TopRefs) Err() error

func (*TopRefs) GetData

func (w *TopRefs) GetData(ctx context.Context, a Args) (more bool, err error)

func (TopRefs) HTML

func (w TopRefs) HTML() template.HTML

func (TopRefs) ID added in v2.2.0

func (w TopRefs) ID() int

func (TopRefs) Label

func (w TopRefs) Label(ctx context.Context) string

func (TopRefs) Name

func (w TopRefs) Name() string

func (TopRefs) RenderHTML

func (w TopRefs) RenderHTML(ctx context.Context, shared SharedData) (string, any)

func (*TopRefs) SetErr

func (w *TopRefs) SetErr(h error)

func (*TopRefs) SetHTML

func (w *TopRefs) SetHTML(h template.HTML)

func (*TopRefs) SetSettings

func (w *TopRefs) SetSettings(s goatcounter.WidgetSettings)

func (TopRefs) Settings

func (w TopRefs) Settings() goatcounter.WidgetSettings

func (TopRefs) Type

func (w TopRefs) Type() string

type TotalCount

type TotalCount struct {
	goatcounter.TotalCount

	NoEvents bool
	// contains filtered or unexported fields
}

func (TotalCount) Err

func (w TotalCount) Err() error

func (*TotalCount) GetData

func (w *TotalCount) GetData(ctx context.Context, a Args) (more bool, err error)

func (TotalCount) HTML

func (w TotalCount) HTML() template.HTML

func (TotalCount) ID added in v2.2.0

func (w TotalCount) ID() int

func (TotalCount) Label

func (w TotalCount) Label(ctx context.Context) string

func (TotalCount) Name

func (w TotalCount) Name() string

func (TotalCount) RenderHTML

func (w TotalCount) RenderHTML(context.Context, SharedData) (string, any)

func (*TotalCount) SetErr

func (w *TotalCount) SetErr(h error)

func (*TotalCount) SetHTML

func (w *TotalCount) SetHTML(h template.HTML)

func (*TotalCount) SetSettings

func (w *TotalCount) SetSettings(s goatcounter.WidgetSettings)

func (TotalCount) Settings

func (w TotalCount) Settings() goatcounter.WidgetSettings

func (TotalCount) Type

func (w TotalCount) Type() string

type TotalPages

type TotalPages struct {
	Align, NoEvents bool
	Style           string
	Max             int
	Total           goatcounter.HitList
	// contains filtered or unexported fields
}

func (TotalPages) Err

func (w TotalPages) Err() error

func (*TotalPages) GetData

func (w *TotalPages) GetData(ctx context.Context, a Args) (more bool, err error)

func (TotalPages) HTML

func (w TotalPages) HTML() template.HTML

func (TotalPages) ID added in v2.2.0

func (w TotalPages) ID() int

func (TotalPages) Label

func (w TotalPages) Label(ctx context.Context) string

func (TotalPages) Name

func (w TotalPages) Name() string

func (TotalPages) RenderHTML

func (w TotalPages) RenderHTML(ctx context.Context, shared SharedData) (string, any)

func (*TotalPages) SetErr

func (w *TotalPages) SetErr(h error)

func (*TotalPages) SetHTML

func (w *TotalPages) SetHTML(h template.HTML)

func (*TotalPages) SetSettings

func (w *TotalPages) SetSettings(s goatcounter.WidgetSettings)

func (TotalPages) Settings

func (w TotalPages) Settings() goatcounter.WidgetSettings

func (TotalPages) Type

func (w TotalPages) Type() string

type Widget

type Widget interface {
	GetData(context.Context, Args) (bool, error)
	RenderHTML(context.Context, SharedData) (string, any)

	SetHTML(template.HTML)
	HTML() template.HTML
	SetErr(error)
	Err() error
	SetSettings(goatcounter.WidgetSettings)
	Settings() goatcounter.WidgetSettings
	ID() int

	Name() string
	Type() string // "full-width", "hchart"
	Label(context.Context) string
}

func FromSiteWidget

func FromSiteWidget(ctx context.Context, w goatcounter.Widget) Widget

func NewWidget

func NewWidget(name string, id int) Widget

Jump to

Keyboard shortcuts

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