analytics

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Record

func Record(eventType EventType, userId int, value ...map[string]interface{})

func RecordStruct

func RecordStruct(eventType EventType, userId int, str interface{}) error

func Start

func Start(conf *config.Options)

func StructToMap

func StructToMap(v interface{}) (map[string]interface{}, error)

Types

type Event

type Event struct {
	Type        EventType              `json:"type"`
	CreatedAt   time.Time              `json:"created_at"`
	EsTimeStamp int64                  `json:"@timestamp"`
	UserId      int                    `json:"user_id"`
	Values      map[string]interface{} `json:"values"` // 考虑通用性,values根据不同type进行不同的序列化/反序列化
}

type EventType

type EventType string
const (
	EventTypeDeviceAdd    EventType = "device_add"
	EventTypeDeviceDelete EventType = "device_delete"
	EventTypePluginAdd    EventType = "plugin_add"
	EventTypePluginDelete EventType = "plugin_delete"
)

Jump to

Keyboard shortcuts

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