rules

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

func NewService(db *gorm.DB) 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(name, namespace, groupName, template string, providerNamespace uint64) ([]Rule, error)

func (Repository) Migrate

func (r Repository) Migrate() error

func (Repository) Upsert

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

type Rule

type Rule struct {
	Id                    uint64 `gorm:"primarykey"`
	CreatedAt             time.Time
	UpdatedAt             time.Time
	Name                  string `gorm:"index:idx_rule_name,unique"`
	Namespace             string `gorm:"uniqueIndex:unique_name"`
	GroupName             string `gorm:"uniqueIndex:unique_name"`
	Template              string `gorm:"uniqueIndex:unique_name"`
	Enabled               *bool
	Variables             string               `gorm:"type:jsonb" sql:"type:jsonb"`
	ProviderNamespace     uint64               `gorm:"uniqueIndex:unique_name"`
	ProviderNamespaceInfo *namespace.Namespace `gorm:"foreignKey:ProviderNamespace"`
}

type RuleRepository

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

Repository interface

type RuleRepositoryMock

type RuleRepositoryMock struct {
	mock.Mock
}

RuleRepositoryMock 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 uint64) ([]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 domain.TemplatesService) (*Rule, error)

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

type RuleResponse added in v0.3.0

type RuleResponse struct {
	NamespaceUrn string
	ProviderUrn  string
	ProviderType string
	ProviderHost string
}

type Service

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

Service handles business logic

func (Service) Get

func (service Service) Get(name, namespace, groupName, template string, providerNamespace uint64) ([]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