analytics

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppIDHappa = iota
)

Variables

This section is empty.

Functions

func IsInvalidConfig

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

func IsValidation

func IsValidation(err error) bool

IsValidation asserts validationError.

Types

type Analytics

type Analytics struct {
	// contains filtered or unexported fields
}

func New

func New(config Config) (*Analytics, error)

func (*Analytics) Report

func (a *Analytics) Report(ctx context.Context, e Event) (Event, error)

type AppID

type AppID string

func (AppID) IsValid

func (a AppID) IsValid() bool

type Config

type Config struct {
	Log *zap.SugaredLogger

	CredentialsJSON string
	Environment     string
}

type Event

type Event struct {
	AppID                AppID                  `firestore:"app_id"`
	SessionID            string                 `firestore:"session_id"`
	PayloadType          string                 `firestore:"payload_type"`
	PayloadSchemaVersion int                    `firestore:"payload_schema_version"`
	Payload              map[string]interface{} `firestore:"payload"`
	URI                  string                 `firestore:"uri_path"`
	Timestamp            time.Time              `firestore:"timestamp"`
	InstallationID       string                 `firestore:"installation_id"`
	EnvironmentClass     string                 `firestore:"env_class"`
}

func (*Event) CollectionName

func (e *Event) CollectionName() string

CollectionName creates a firestore collection name based on the year, month, and environment type (stable, testing).

type Reporter

type Reporter interface {
	Report(ctx context.Context, event Event) (Event, error)
}

Jump to

Keyboard shortcuts

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