alert_history

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 17, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

func NewService(db *gorm.DB) domain.AlertHistoryService

NewService returns repository struct

Types

type Alert

type Alert struct {
	ID          uint64 `gorm:"primarykey"`
	CreatedAt   time.Time
	UpdatedAt   time.Time
	Resource    string
	Template    string
	MetricName  string
	MetricValue string
	Level       string
}

type AlertHistoryRepository

type AlertHistoryRepository interface {
	Create(*Alert) (*Alert, error)
	Get(string, uint32, uint32) ([]Alert, error)
	Migrate() error
}

type AlertHistoryRepositoryMock

type AlertHistoryRepositoryMock struct {
	mock.Mock
}

AlertHistoryRepositoryMock is an autogenerated mock type for the AlertHistoryRepositoryMock type

func (*AlertHistoryRepositoryMock) Create

func (_m *AlertHistoryRepositoryMock) Create(_a0 *Alert) (*Alert, error)

Create provides a mock function with given fields: _a0

func (*AlertHistoryRepositoryMock) Get

func (_m *AlertHistoryRepositoryMock) Get(_a0 string, _a1 uint32, _a2 uint32) ([]Alert, error)

Get provides a mock function with given fields: _a0, _a1, _a2

func (*AlertHistoryRepositoryMock) Migrate

func (_m *AlertHistoryRepositoryMock) Migrate() error

Migrate provides a mock function with given fields:

type Repository

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

Repository talks to the store to read or insert data

func NewRepository

func NewRepository(db *gorm.DB) *Repository

NewRepository returns repository struct

func (Repository) Create

func (r Repository) Create(alert *Alert) (*Alert, error)

func (Repository) Get

func (r Repository) Get(resource string, startTime uint32, endTime uint32) ([]Alert, error)

func (Repository) Migrate

func (r Repository) Migrate() error

type Service

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

Service handles business logic

func (Service) Create

func (service Service) Create(alerts *domain.Alerts) ([]domain.AlertHistoryObject, error)

Creating all valid alert history objects from array of objects

func (Service) Get

func (service Service) Get(resource string, startTime uint32, endTime uint32) ([]domain.AlertHistoryObject, error)

func (Service) Migrate

func (service Service) Migrate() error

Jump to

Keyboard shortcuts

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