alerts

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

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

NewService returns repository struct

Types

type Alert

type Alert struct {
	Id           uint64 `gorm:"primarykey"`
	Provider     *provider.Provider
	ProviderId   uint64
	ResourceName string
	MetricName   string
	MetricValue  string
	Severity     string
	Rule         string
	TriggeredAt  time.Time
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

type AlertRepository

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

type MockAlertRepository

type MockAlertRepository struct {
	mock.Mock
}

MockAlertRepository is an autogenerated mock type for the AlertRepository type

func (*MockAlertRepository) Create

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

Create provides a mock function with given fields: _a0

func (*MockAlertRepository) Get

func (_m *MockAlertRepository) Get(_a0 string, _a1 uint64, _a2 uint64, _a3 uint64) ([]Alert, error)

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

func (*MockAlertRepository) Migrate

func (_m *MockAlertRepository) 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(resourceName string, providerId, startTime, endTime uint64) ([]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.Alert, error)

func (Service) Get

func (service Service) Get(resourceName string, providerId, startTime, endTime uint64) ([]domain.Alert, 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