analytics

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompressFiles

func CompressFiles(input *core.InputFiles) ([]byte, error)

func CreateUser

func CreateUser(email string) error

func SendTrackingToServer

func SendTrackingToServer(bundle *Client) error

Types

type AnalyticsFile

type AnalyticsFile struct {
	Email string
	Id    string
}

type Client

type Client struct {
	UserId     string                 `json:"id"`
	Event      string                 `json:"event"`
	Source     []byte                 `json:"source,omitempty"`
	Properties map[string]interface{} `json:"properties,omitempty"`
}

func NewClient

func NewClient(properties map[string]interface{}) (*Client, error)

func (*Client) AppendProperties

func (t *Client) AppendProperties(properties map[string]interface{})

func (*Client) Debug

func (t *Client) Debug(event string)

func (*Client) Error

func (t *Client) Error(event string)

func (*Client) Hash

func (t *Client) Hash(value any) string

Hash hashes a value, using this analytic sender's UserId as a salt. It does not output anything or in any way modify the sender's state.

func (*Client) Info

func (t *Client) Info(event string)

func (*Client) NewFieldListener

func (client *Client) NewFieldListener(level zapcore.LevelEnabler) zapcore.Core

func (*Client) Panic

func (t *Client) Panic(event string)

func (*Client) PanicHandler

func (t *Client) PanicHandler(err *error, errHandler ErrorHandler)

func (*Client) UploadSource

func (t *Client) UploadSource(source *core.InputFiles)

func (*Client) Warn

func (t *Client) Warn(event string)

type ErrorHandler

type ErrorHandler interface {
	PrintErr(err error)
}

type LogLevel

type LogLevel string
var (
	Panic LogLevel = "panic"
	Error LogLevel = "error"
	Warn  LogLevel = "warn"
	Info  LogLevel = "info"
	Debug LogLevel = "debug"
)

type User

type User struct {
	Email string `json:"email,omitempty"`
	// uuid generated if user does not provide email
	Id string `json:"id,omitempty"`
	// omit validated field from being saved since we wouldn't trust the client side value anyways
	Validated bool `json:"-"`
}

func RetrieveUser

func RetrieveUser(result AnalyticsFile) *User

func (*User) CheckUserEmailValidation

func (u *User) CheckUserEmailValidation() (*Validated, error)

func (*User) RegisterUser

func (u *User) RegisterUser() error

func (*User) SendUserEmailValidation

func (u *User) SendUserEmailValidation() error

type Validated

type Validated struct {
	Validated bool
}

Jump to

Keyboard shortcuts

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