Documentation
¶
Index ¶
- func ToggleLogger(enable bool)
- type DTAnalytics
- func (_ DTAnalytics) Close()
- func (_ DTAnalytics) Flush()
- func (dta DTAnalytics) Track(dtId string, acId string, eventName string, properties map[string]interface{}) error
- func (dta DTAnalytics) UserAdd(dtId string, acId string, properties map[string]interface{}) error
- func (dta DTAnalytics) UserAppend(dtId string, acId string, properties map[string]interface{}) error
- func (dta DTAnalytics) UserDelete(dtId string, acId string, properties map[string]interface{}) error
- func (dta DTAnalytics) UserSet(dtId string, acId string, properties map[string]interface{}) error
- func (dta DTAnalytics) UserSetOnce(dtId string, acId string, properties map[string]interface{}) error
- func (dta DTAnalytics) UserUniqAppend(dtId string, acId string, properties map[string]interface{}) error
- func (dta DTAnalytics) UserUnset(dtId string, acId string, properties map[string]interface{}) error
- type DTConsumer
- type DTLogConsumer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DTAnalytics ¶
type DTAnalytics struct{}
func New ¶
func New(consumer DTConsumer, isDebug bool) (DTAnalytics, error)
New for initialization of the DTAnalytics with given consumer. If isDebug is set to true, the data will not be inserted to production environment.
func (DTAnalytics) Close ¶
func (_ DTAnalytics) Close()
Close the DTAnalytics, remember to call this before the program finishes to preventing data loss!
func (DTAnalytics) Track ¶
func (dta DTAnalytics) Track(dtId string, acId string, eventName string, properties map[string]interface{}) error
Track an event (custom or preset). returns
- nil if given event and properties is valid, or
- error if there are invalid and will not be processed.
func (DTAnalytics) UserAdd ¶
func (dta DTAnalytics) UserAdd(dtId string, acId string, properties map[string]interface{}) error
UserAdd Arithmetic add the value of property by given number for user with given dtId and acId. Hence, the type of value for 'custom properties' should be a number. returns
- nil if given event and properties is valid, or
- error if there are invalid and will not be processed.
func (DTAnalytics) UserAppend ¶
func (dta DTAnalytics) UserAppend(dtId string, acId string, properties map[string]interface{}) error
UserAppend Append values to property for the user with given dtId and acId. Hence, the type of value for 'custom properties' should be an array. returns
- nil if given event and properties is valid, or
- error if there are invalid and will not be processed.
func (DTAnalytics) UserDelete ¶
func (dta DTAnalytics) UserDelete(dtId string, acId string, properties map[string]interface{}) error
UserDelete Delete the user with given dtId and acId. returns
- nil if given event and properties is valid, or
- error if there are invalid and will not be processed.
func (DTAnalytics) UserSet ¶
func (dta DTAnalytics) UserSet(dtId string, acId string, properties map[string]interface{}) error
UserSet Set user properties for the user with given dtId and acId. returns
- nil if given event and properties is valid, or
- error if there are invalid and will not be processed.
func (DTAnalytics) UserSetOnce ¶
func (dta DTAnalytics) UserSetOnce(dtId string, acId string, properties map[string]interface{}) error
UserSetOnce Set user properties only once for user with given dtId and acId. The value will not override existed property. returns
- nil if given event and properties is valid, or
- error if there are invalid and will not be processed.
func (DTAnalytics) UserUniqAppend ¶
func (dta DTAnalytics) UserUniqAppend(dtId string, acId string, properties map[string]interface{}) error
UserUniqAppend Append values to property without duplications for the user with given dtId and acId. Hence, the type of value for 'custom properties' should be an array. returns
- nil if given event and properties is valid, or
- error if there are invalid and will not be processed.
func (DTAnalytics) UserUnset ¶
func (dta DTAnalytics) UserUnset(dtId string, acId string, properties map[string]interface{}) error
UserUnset Unset properties for user with given dtId and acId. Only the key of 'custom properties' will be used and its value is meaningless here. returns
- nil if given event and properties is valid, or
- error if there are invalid and will not be processed.
type DTConsumer ¶
type DTConsumer interface {
// contains filtered or unexported methods
}
func NewDTLogConsumer ¶
func NewDTLogConsumer(path string, maxBatchLen uint32, namePrefix string, maxFileSizeBytes uint64) DTConsumer
NewDTLogConsumer creates an DTConsumer to log the events. Event logs will be stored in the path with name_prefix. The inputted event will be buffered and be written to log per every max_batch_len length. Also, the event log is sharding by either of these circumstances:
- Every hour,
- File size is over approximated maximum file size max_file_size_bytes in bytes (0 for unlimited).
type DTLogConsumer ¶
type DTLogConsumer struct {
// contains filtered or unexported fields
}