rules

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: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

func NewService(db *gorm.DB, client cortexCaller) domain.RuleService

NewService returns repository struct

Types

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) Get

func (r Repository) Get(namespace string, entity string, groupName string, status string, template string) ([]Rule, error)

func (Repository) Migrate

func (r Repository) Migrate() error

func (Repository) Upsert

func (r Repository) Upsert(rule *Rule, client cortexCaller, templatesService domain.TemplatesService) (*Rule, error)

type Rule

type Rule struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time
	Name      string `gorm:"index:idx_rule_name,unique"`
	Namespace string
	Entity    string
	GroupName string
	Template  string
	Status    string
	Variables string `gorm:"type:jsonb" sql:"type:jsonb"`
}

type RuleRepository

type RuleRepository interface {
	Upsert(*Rule, cortexCaller, domain.TemplatesService) (*Rule, error)
	Get(string, string, string, string, string) ([]Rule, error)
	Migrate() error
}

Repository interface

type RuleRepositoryMock

type RuleRepositoryMock struct {
	mock.Mock
}

RuleRepository is an autogenerated mock type for the RuleRepository type

func (*RuleRepositoryMock) Get

func (_m *RuleRepositoryMock) Get(_a0 string, _a1 string, _a2 string, _a3 string, _a4 string) ([]Rule, error)

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

func (*RuleRepositoryMock) Migrate

func (_m *RuleRepositoryMock) Migrate() error

Migrate provides a mock function with given fields:

func (*RuleRepositoryMock) Upsert

func (_m *RuleRepositoryMock) Upsert(_a0 *Rule, _a1 cortexCaller, service domain.TemplatesService) (*Rule, error)

Upsert provides a mock function with given fields: _a0, _a1

type Service

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

Service handles business logic

func (Service) Get

func (service Service) Get(namespace, entity, groupName, status, template string) ([]domain.Rule, error)

func (Service) Migrate

func (service Service) Migrate() error

func (Service) Upsert

func (service Service) Upsert(rule *domain.Rule) (*domain.Rule, error)

type Variables

type Variables struct {
	Variables []variable `json:"variables"`
}

Jump to

Keyboard shortcuts

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