model

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_DataSection = 5

*

设置最大的段位制 5

Variables

This section is empty.

Functions

func DataSectionField

func DataSectionField() []db.Fields

func GetVisitActionData

func GetVisitActionData(action *VisitAction) db.DataMap

func GetVisitData

func GetVisitData(visit *Visit) db.DataMap

func GetVisitEventData

func GetVisitEventData(event *VisitEvent) db.DataMap

func GetVisitPageData

func GetVisitPageData(page *VisitPage) db.DataMap

func GetVisitorData

func GetVisitorData(visitor *Visitor) db.DataMap

func NewVisitActionTable

func NewVisitActionTable() *db.Table

func NewVisitEventTable

func NewVisitEventTable() *db.Table

func NewVisitPageTable

func NewVisitPageTable() *db.Table

func NewVisitTable

func NewVisitTable() *db.Table

func NewVisitorTable

func NewVisitorTable() *db.Table

Types

type DataSection

type DataSection struct {
	DataSection []interface{}
}

func (*DataSection) Data

func (this *DataSection) Data(data ...interface{})

type IMetaData

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

type MetaApp

type MetaApp struct {
	AppName    string
	AppVersion string
}

type MetaArray

type MetaArray map[string]interface{}

type MetaChannel

type MetaChannel struct {
	ChannelName string `db:"channelName"`
}

*

渠道

type MetaData

type MetaData struct {
	Location MetaLocation
	Device   MetaDevice
	App      MetaApp
	Channel  MetaChannel
}

func (*MetaData) Data

func (this *MetaData) Data(data ...interface{})

*

可以配置Meta

type MetaDevice

type MetaDevice struct {
	//移动设备信息
	DeviceId        string // 设配ID
	DeviceOS        string // 设备操作系统
	DeviceOsVersion string // 设备系统版本
	DeviceBrand     string // 设备品牌
}

type MetaLocation

type MetaLocation struct {
	Ip          string // IP 地址
	IpCountry   string // 国家        //时区?
	IpCity      string
	IpLatitude  float64 // 经纬度
	IpLongitude float64 // 经纬度
}

*

可以根据  GEO  来解析

type Vid

type Vid int64

type Visit

type Visit struct {
	VisitId   int64 // 会话ID
	VisitorId Vid   // 访客

	Meta MetaData
	Data DataSection

	RefererPage    string //
	EnterVisitPage string // 访问的页面
	ExitVisitPage  string // 退出的页面
	VisitTime      time.Time
	LastActiveTime time.Time // 最后活动时间

	sync.RWMutex
	// contains filtered or unexported fields
}

*

访问模型

func NewVisit

func NewVisit(visitor *Visitor) *Visit

func (*Visit) Action

func (this *Visit) Action(group, name string, data ...interface{})

func (*Visit) Close

func (this *Visit) Close()

func (*Visit) Event

func (this *Visit) Event(name string, data ...interface{})

func (*Visit) GetVisitId

func (this *Visit) GetVisitId() int64

func (*Visit) VisitPage

func (this *Visit) VisitPage(page string, data ...interface{}) *VisitPage

type VisitAction

type VisitAction struct {
	ActionId    int64
	VisitId     int64
	VisitorId   Vid
	VisitPageId int64 // 时间发生的页面

	ActionGroup string // 行为分组
	ActionName  string // 行为名称
	Data        DataSection
	ActionTime  time.Time
	// contains filtered or unexported fields
}

*

用户行为跟踪。

func (*VisitAction) Action

func (this *VisitAction) Action(group, name string) *VisitAction

func (*VisitAction) Save

func (this *VisitAction) Save()

type VisitEvent

type VisitEvent struct {
	EventId   int64 // 事件ID
	VisitId   int64
	VisitorId Vid // 访问

	EventName string // 事件
	Data      DataSection
	EventTime time.Time // 事件时间
	// contains filtered or unexported fields
}

*

普通事件

func (*VisitEvent) Event

func (this *VisitEvent) Event(name string) *VisitEvent

func (*VisitEvent) Save

func (this *VisitEvent) Save()

type VisitPage

type VisitPage struct {
	VisitPageId int64
	VisitId     int64
	VisitorId   Vid

	RefererPage string    //来源页面
	VisitPage   string    //访问页面
	VisitTime   time.Time //访问时间
	VisitSpent  int64     //访问时长
	Refresh     int       //刷新次数。
	Data        DataSection
	// contains filtered or unexported fields
}

* 页面跟踪

func (*VisitPage) Action

func (this *VisitPage) Action(group, name string, data ...interface{}) *VisitAction

func (*VisitPage) Page

func (this *VisitPage) Page(page string) *VisitPage

func (*VisitPage) Save

func (this *VisitPage) Save()

func (*VisitPage) Update

func (this *VisitPage) Update()

type Visitor

type Visitor struct {
	VisitorId      Vid       // 用户ID
	FirstVisitTime time.Time // 首次访问时间 ,确认是否为新用户。
	Meta           MetaData
	Data           DataSection
	LastVisitTime  time.Time // 最后活动时间
	// contains filtered or unexported fields
}

访客

func GetVisitor

func GetVisitor(visitorId Vid) *Visitor

func (*Visitor) Save

func (this *Visitor) Save() (int64, error)

Jump to

Keyboard shortcuts

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