entity

package
v0.0.0-...-6edac6f Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultLimit  = 10
	DefaultOffset = 0
)

Variables

This section is empty.

Functions

func NewActionService

func NewActionService(s *store.Store) *actionManager

func NewAppService

func NewAppService(s *store.Store) *appManager

func NewCachedSessionService

func NewCachedSessionService(s *store.Store, c *cache.Cache) *cachedSessionManager

func NewDeviceService

func NewDeviceService(s *store.Store) *deviceManager

func NewEventAggregate

func NewEventAggregate(s *store.Store) *evtAggregate

func NewEventQuery

func NewEventQuery(q *ent.EventQuery, qs ...QueryEvent)

func NewEventService

func NewEventService(s *store.Store) *eventManager

func NewGroupService

func NewGroupService(c *ent.GroupClient) *groupManager

func NewSessionService

func NewSessionService(s *store.Store) *sessionManager

func NewUserService

func NewUserService(s *store.Store) *userManager

Types

type Action

type Action struct {
	ID       int `json:"id"`
	Action   string
	Category string
	Label    string
	Property string
	Value    interface{}
}

func NewAction

func NewAction(a *contexts.Action) *Action

type ActionManager

type ActionManager interface {
	// contains filtered or unexported methods
}

type ActionReader

type ActionReader interface {
	List() ([]*Action, error)
	Get(id int) (*Action, error)
}

type ActionWriter

type ActionWriter interface {
	Create(*Action, ...CreateActionEdge) error
	Update(*Action, ...UpdateActionEdge) error
	Delete(*Action) error
}

type App

type App struct {
	ID         int    `db:"id" json:"id"`
	Name       string `db:"name" json:"name"`
	Version    string
	Build      string
	Properties map[string]interface{}
}

type AppManager

type AppManager interface {
	// contains filtered or unexported methods
}

type AppReader

type AppReader interface {
	List() ([]*App, error)
	Get(int) (*App, error)
}

type AppReporter

type AppReporter interface {
	AppReader
}

type AppWriter

type AppWriter interface {
	Create(*App) error
	Update(*App) error
	Delete(*App) error
}

type Campaign

type Campaign struct {
	ID      int
	Name    string
	Source  string
	Medium  string
	Term    string
	Content string
}

type CreateActionEdge

type CreateActionEdge func(*ent.ActionCreate)

func ActionWithEventEdge

func ActionWithEventEdge(id uuid.UUID) CreateActionEdge

type CreateEventEdge

type CreateEventEdge func(c *ent.EventCreate)

type Device

type Device struct {
	ID           string                 `json:"id"`
	Manufacturer string                 `json:"manufacturer"`
	Model        string                 `json:"model"`
	Name         string                 `json:"name"`
	Type         string                 `json:"type"`
	Version      string                 `json:"version"`
	Mobile       bool                   `json:"mobile"`
	Tablet       bool                   `json:"tablet"`
	Desktop      bool                   `json:"desktop"`
	Properties   map[string]interface{} `json:"properties"`
}

type DeviceManager

type DeviceManager interface {
	// contains filtered or unexported methods
}

type DeviceReader

type DeviceReader interface {
	List(QueryParams) ([]*Device, error)
	Get(id string) (*Device, error)
}

type DeviceReporter

type DeviceReporter interface {
	DeviceReader
}

type DeviceWriter

type DeviceWriter interface {
	Create(*Device) error
	Update(*Device) error
	Delete(*Device) error
}

type Event

type Event struct {
	ID         uuid.UUID `json:"id"`
	TrackingID string    `json:"trackingID"`
	UserID     string    `json:"userID"`
	GroupID    int       `json:"groupID"`
	SessionID  uuid.UUID `json:"sessionID"`
	DeviceID   string    `json:"deviceID"`

	Anonymous      bool `json:"anonymous"`
	NonInteractive bool `json:"nonInteractive"`

	Type      string    `json:"type"`
	Channel   string    `json:"channel"`
	Platform  string    `json:"platform"`
	Timestamp time.Time `json:"timestamp"`
}

func NewEvent

func NewEvent(evt *revent.Event) (*Event, error)

type EventAggregate

type EventAggregate interface {
	Count(...QueryEvent) (int, error)
	GroupBy(ScannableQueryBuild, interface{}, ...QueryEvent) error
}

type EventManager

type EventManager interface {
	// contains filtered or unexported methods
}

type EventQuery

type EventQuery interface {
	All(context.Context) ([]*ent.Event, error)
}

type EventQueryBuild

type EventQueryBuild func(q *ent.EventQuery, qs ...QueryEvent)

type EventReader

type EventReader interface {
	List(QueryParams) ([]*Event, error)
	Get(id uuid.UUID) (*Event, error)
	Query(...QueryEvent) ([]*Event, error)
}

type EventTransaction

type EventTransaction interface {
	NewEvent(context.Context, *event.Event) error
}

func NewEventTransaction

func NewEventTransaction(s *store.Store) EventTransaction

type EventWriter

type EventWriter interface {
	Create(*Event, ...CreateEventEdge) error
	Update(*Event, ...UpdateEventEdge) error
	Delete(*Event) error
}

type Group

type Group struct {
	ID     int               `json:"id"`
	Name   string            `json:"name"`
	Meta   map[string]string `json:"meta"`
	Users  []*User           `json:"users"`
	Groups []*Group          `json:"groups"`
}

type GroupManager

type GroupManager interface {
	// contains filtered or unexported methods
}

type GroupReader

type GroupReader interface {
	List(QueryParams) ([]*Group, error)
	Get(id int) (*Group, error)
}

type GroupWriter

type GroupWriter interface {
	Create(*Group) error
	Update(*Group) error
	Delete(*Group) error
}

type PageStats

type PageStats struct {
	New            bool      `db:"-" json:"-"`
	SiteID         int64     `db:"site_id" json:"-"`
	HostnameID     int64     `db:"hostname_id" json:"-"`
	PathnameID     int64     `db:"pathname_id" json:"-"`
	Hostname       string    `db:"hostname"`
	Pathname       string    `db:"pathname"`
	Pageviews      int64     `db:"pageviews"`
	Visitors       int64     `db:"visitors"`
	Entries        int64     `db:"entries"`
	BounceRate     float64   `db:"bounce_rate"`
	AvgDuration    float64   `db:"avg_duration"`
	KnownDurations int64     `db:"known_durations"`
	Date           time.Time `db:"ts" json:",omitempty"`
}

type QueryEvent

type QueryEvent func(q *ent.EventQuery)

func EventHasAction

func EventHasAction() QueryEvent

func EventLimit

func EventLimit(l int) QueryEvent

func EventOffset

func EventOffset(o int) QueryEvent

func EventTimeAfter

func EventTimeAfter(t time.Time) QueryEvent

func EventTimeBefore

func EventTimeBefore(t time.Time) QueryEvent

type QueryParams

type QueryParams struct {
	DeviceIDs  []string          `json:"cid" query:"cid"`
	SessionIDs []uuid.UUID       `json:"sid" query:"sid"`
	UserIDs    []uuid.UUID       `json:"uid" query:"uid"`
	GroupIDs   []int             `json:"gid" query:"gid"`
	Offset     int               `json:"offset" query:"offset"`
	Limit      int               `json:"limit" query:"limit"`
	Start      int               `json:"start" query:"start"`
	End        int               `json:"end" query:"end"`
	Params     map[string]string `json:"params" query:"params"`
}

func (QueryParams) QueryEvent

func (qp QueryParams) QueryEvent() []QueryEvent

type ReferrerStats

type ReferrerStats struct {
	New            bool      `db:"-" json:"-"`
	SiteID         int64     `db:"site_id" json:"-"`
	HostnameID     int64     `db:"hostname_id" json:"-"`
	PathnameID     int64     `db:"pathname_id" json:"-"`
	Hostname       string    `db:"hostname"`
	Pathname       string    `db:"pathname"`
	Group          string    `db:"groupname"`
	Visitors       int64     `db:"visitors"`
	Pageviews      int64     `db:"pageviews"`
	BounceRate     float64   `db:"bounce_rate"`
	AvgDuration    float64   `db:"avg_duration"`
	KnownDurations int64     `db:"known_durations"`
	Date           time.Time `db:"ts" json:",omitempty"`
}

type ScannableQuery

type ScannableQuery interface {
	Scan(context.Context, interface{}) error
}

func TopActionCategories

func TopActionCategories(q *ent.EventQuery, qs ...QueryEvent) ScannableQuery

type ScannableQueryBuild

type ScannableQueryBuild func(q *ent.EventQuery, qs ...QueryEvent) ScannableQuery

type Session

type Session struct {
	ID         uuid.UUID
	UserID     string
	DeviceID   *string
	AppID      int
	NewUser    bool
	IsUnique   bool
	IsBounce   bool
	IsFinished bool
	Duration   int
	StartedAt  time.Time
	FinishedAt *time.Time
}

type SessionManager

type SessionManager interface {
	// contains filtered or unexported methods
}

type SessionReader

type SessionReader interface {
	List(QueryParams) ([]*Session, error)
	Get(uuid.UUID) (*Session, error)
}

type SessionReporter

type SessionReporter interface {
	SessionReader
}

type SessionWriter

type SessionWriter interface {
	Create(*Session) error
	Update(*Session) error
	Delete(*Session) error
}

type SiteStats

type SiteStats struct {
	New            bool      `db:"-" json:"-" `
	SiteID         int64     `db:"site_id" json:"-"`
	Visitors       int64     `db:"visitors"`
	Pageviews      int64     `db:"pageviews"`
	Sessions       int64     `db:"sessions"`
	BounceRate     float64   `db:"bounce_rate"`
	AvgDuration    float64   `db:"avg_duration"`
	KnownDurations int64     `db:"known_durations" json:",omitempty"`
	Date           time.Time `db:"ts" json:",omitempty"`
}

func (*SiteStats) FormattedDuration

func (s *SiteStats) FormattedDuration() string

type UpdateActionEdge

type UpdateActionEdge func(*ent.ActionUpdate)

type UpdateEventEdge

type UpdateEventEdge func(c *ent.EventUpdate)

type User

type User struct {
	ID        string                 `json:"id"`
	Anonymous bool                   `json:"anonymous"`
	Name      string                 `json:"name"`
	Title     string                 `json:"title"`
	FirstName string                 `json:"first_name"`
	LastName  string                 `json:"last_name"`
	Email     string                 `json:"email"`
	Username  string                 `json:"username"`
	Age       int                    `json:"age"`
	Birthday  time.Time              `json:"birthday"`
	Gender    string                 `json:"gender"`
	Phone     string                 `json:"phone"`
	Website   string                 `json:"website"`
	Extra     map[string]interface{} `json:"extra"`
}

type UserManager

type UserManager interface {
	// contains filtered or unexported methods
}

type UserReader

type UserReader interface {
	List(QueryParams) ([]*User, error)
	Get(id string) (*User, error)
}

type UserReporter

type UserReporter interface {
	UserReader
}

type UserWriter

type UserWriter interface {
	Create(*User) error
	Update(*User) error
	Delete(*User) error
}

Jump to

Keyboard shortcuts

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