metrics

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Sanitizer Sanitizer
	Service   IService
}

Config for this controller

type Controller

type Controller interface {
	CreateMixMetric(c *gin.Context)
	RegisterRoutes(router *gin.Engine)
}

Controller ...

func New

func New(cfg Config) Controller

New returns a new metrics.Controller

type Db

type Db struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Db holds data for metrics

func NewDb added in v0.0.4

func NewDb() *Db

NewDb constructor

func (*Db) Add

func (db *Db) Add(metric models.PersistedMixMetric)

Add adds a models.PersistedMixMetric to the database

func (*Db) List

func (db *Db) List() []models.PersistedMixMetric

List returns all models.PersistedMixMetric in the database

type IDb added in v0.0.4

type IDb interface {
	Add(models.PersistedMixMetric)
	List() []models.PersistedMixMetric
}

IDb holds metrics information

type IService added in v0.0.4

type IService interface {
	CreateMixMetric(metric models.MixMetric)
	List() []models.PersistedMixMetric
}

IService defines the REST service interface for metrics.

type Sanitizer added in v0.0.4

type Sanitizer interface {
	Sanitize(input models.MixMetric) models.MixMetric
}

Sanitizer sanitizes untrusted metrics data. It should be used in controllers to wipe out any questionable input at our application's front door.

func NewSanitizer added in v0.0.4

func NewSanitizer(policy *bluemonday.Policy) Sanitizer

NewSanitizer returns a new input sanitizer for metrics

type Service

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

Service struct

func NewService added in v0.0.4

func NewService(db IDb, hub websocket.IHub) *Service

NewService constructor

func (*Service) CreateMixMetric

func (service *Service) CreateMixMetric(metric models.MixMetric)

CreateMixMetric adds a new PersistedMixMetric in the database.

func (*Service) List

func (service *Service) List() []models.PersistedMixMetric

List lists all mix metrics in the database

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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