spec

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2023 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const BaseKey = "__root__"

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateSite

type CreateSite struct {
	Domain      string  `json:"domain"`
	Public      *bool   `json:"public,omitempty"`
	Description *string `json:"description,omitempty"`
}

type Global

type Global[T uint64 | Metrics] struct {
	Elapsed time.Duration `json:"elapsed"`
	Result  T             `json:"result"`
}

type List

type List[T any] struct {
	Elapsed time.Duration `json:"elapsed"`
	Items   []T           `json:"items"`
}

type Metric

type Metric uint8
const (
	Visitors Metric = iota
	Views
	Events
	Visits
	BounceRates
	VisitDurations
)

func ParsMetric added in v0.0.17

func ParsMetric(k string) Metric

func (Metric) Label added in v0.0.17

func (m Metric) Label() string

func (Metric) MarshalJSON added in v0.0.17

func (m Metric) MarshalJSON() ([]byte, error)

func (Metric) String added in v0.0.17

func (m Metric) String() string

func (*Metric) UnmarshalJSON added in v0.0.17

func (m *Metric) UnmarshalJSON(b []byte) error

type Metrics

type Metrics struct {
	Visitors uint64 `json:"visitors,omitempty"`
	Views    uint64 `json:"views,omitempty"`
	Events   uint64 `json:"events,omitempty"`
	Visits   uint64 `json:"visits,omitempty"`
}

type One

type One[T any] struct {
	Elapsed time.Duration `json:"elapsed"`
	Item    T             `json:"item"`
}

type Property added in v0.0.17

type Property uint8
const (
	Base Property = iota
	Event
	Page
	EntryPage
	ExitPage
	Referrer
	UtmMedium
	UtmSource
	UtmCampaign
	UtmContent
	UtmTerm
	UtmDevice
	UtmBrowser
	BrowserVersion
	Os
	OsVersion
	Country
	Region
	City
)

func ParseProperty added in v0.0.17

func ParseProperty(k string) Property

func (Property) MarshalJSON added in v0.0.17

func (p Property) MarshalJSON() ([]byte, error)

func (Property) String added in v0.0.17

func (p Property) String() string

func (*Property) UnmarshalJSON added in v0.0.17

func (p *Property) UnmarshalJSON(b []byte) error

type PropertyResult added in v0.0.17

type PropertyResult[T uint64 | []uint64] struct {
	Timestamps []int64       `json:"timestamps"`
	Elapsed    time.Duration `json:"elapsed"`
	Result     map[string]T  `json:"result"`
}

type QueryOptions added in v0.0.17

type QueryOptions struct {
	Window time.Duration `json:"window,omitempty"`
	Offset time.Duration `json:"offset,omitempty"`
	Metric Metric        `json:"metric,omitempty"`
}

type QueryPropertyOptions added in v0.0.17

type QueryPropertyOptions struct {
	Window   time.Duration `json:"window,omitempty"`
	Offset   time.Duration `json:"offset,omitempty"`
	Metric   Metric        `json:"metric,omitempty"`
	Property Property      `json:"property,omitempty"`
	Selector Select        `json:"selector,omitempty"`
}

func (*QueryPropertyOptions) Defaults added in v0.0.17

func (q *QueryPropertyOptions) Defaults()

type Select added in v0.0.17

type Select struct {
	Exact *string `json:"exact,omitempty"`
	Re    *string `json:"re,omitempty"`
	Glob  *string `json:"glob,omitempty"`
}

type Series added in v0.0.17

type Series[T uint64 | []uint64] struct {
	Timestamps []int64       `json:"timestamps,omitempty"`
	Elapsed    time.Duration `json:"elapsed"`
	Result     T             `json:"result"`
}

type Site

type Site One[Site_]

type SiteList

type SiteList List[Site_]

type Site_

type Site_ struct {
	Domain      string    `json:"domain"`
	Public      bool      `json:"public,omitempty"`
	Description string    `json:"desc,omitempty"`
	Owner       string    `json:"owner"`
	CreatedAt   time.Time `json:"createdAt"`
	UpdatedAt   time.Time `json:"updatedAt"`
}

type UpdateSite

type UpdateSite struct {
	Public      *bool   `json:"public,omitempty"`
	Description *string `json:"description,omitempty"`
}

Jump to

Keyboard shortcuts

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