appmetrics

package
v0.73.9 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

EventSchemaMap Every event should have a schema attached

View Source
var NavigationNavigateToCofxSchema = map[string]interface{}{
	"type": "object",
	"properties": map[string]interface{}{
		"view_id": map[string]interface{}{
			"type":      "string",
			"maxLength": 16,
		},
		"params": map[string]interface{}{
			"type": "object",
			"properties": map[string]interface{}{
				"screen": map[string]interface{}{
					"enum": []string{"allowed-screen-name"},
				},
			},
			"additionalProperties": false,
			"required":             []string{"screen"},
		},
	},
	"additionalProperties": false,
	"required":             []string{"view_id", "params"},
}

Functions

This section is empty.

Types

type AppMetric

type AppMetric struct {
	Event      AppMetricEventType `json:"event"`
	Value      json.RawMessage    `json:"value"`
	AppVersion string             `json:"app_version"`
	OS         string             `json:"os"`
}

Value is `json.RawMessage` so we can send any json shape, including strings Validation is handled using JSON schemas defined in validators.go, instead of Golang structs

type AppMetricEventType

type AppMetricEventType string
const (
	// status-react navigation events
	NavigationNavigateToCofx AppMetricEventType = "navigation/navigate-to"
)

type AppMetricValidationError

type AppMetricValidationError struct {
	Metric AppMetric
	Errors []gojsonschema.ResultError
}

type Database

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

Database sql wrapper for operations with browser objects.

func NewDB

func NewDB(db *sql.DB) *Database

func (Database) Close

func (db Database) Close() error

Close closes database.

func (*Database) GetAppMetrics

func (db *Database) GetAppMetrics(limit int, offset int) (appMetrics []AppMetric, err error)

func (*Database) SaveAppMetrics

func (db *Database) SaveAppMetrics(appMetrics []AppMetric) (err error)

func (*Database) ValidateAppMetrics

func (db *Database) ValidateAppMetrics(appMetrics []AppMetric) (err error)

Jump to

Keyboard shortcuts

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