domain

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AntiAffinityGroupRule

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

AntiAffinityGroupRule defines import path anti-affinity group of a package. Rule `foo/bar` means any package inside it cannot import any other packages except itself. (ex: `foo/bar/baz/*` cannot import `foo/bar/quux/*` and can only import `foo/bar/baz/*`)

func NewAntiAffinityGroupRule

func NewAntiAffinityGroupRule(self Path, group PathPrefix, allowNames []Name) (*AntiAffinityGroupRule, error)

func (*AntiAffinityGroupRule) Check

func (r *AntiAffinityGroupRule) Check(path Path) *Violation

type AntiAffinityListRule added in v0.3.0

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

AntiAffinityListRule defines import path anti-affinity list of a package. any packages inside a path prefix cannot be imported. (ex: when prefix `foo/bar` and `baz` are defined, `foo/bar/*` and `baz/*` cannot be imported)

func NewAntiAffinityListRule added in v0.3.0

func NewAntiAffinityListRule(self Path, prefixes []PathPrefix, label RuleLabel) (*AntiAffinityListRule, error)

func (*AntiAffinityListRule) Check added in v0.3.0

func (r *AntiAffinityListRule) Check(path Path) *Violation

type AntiAffinityRule

type AntiAffinityRule interface {
	Check(Path) *Violation
}

type AntiAffinityRuleRepository

type AntiAffinityRuleRepository interface {
	ListByPath(Path) ([]AntiAffinityRule, error)
}

AntiAffinityRuleRepository provides AntiAffinityRule as a query

type AntiAffinityRuleRepositoryMock

type AntiAffinityRuleRepositoryMock struct {
	// ListByPathFunc mocks the ListByPath method.
	ListByPathFunc func(path Path) ([]AntiAffinityRule, error)
	// contains filtered or unexported fields
}

AntiAffinityRuleRepositoryMock is a mock implementation of AntiAffinityRuleRepository.

func TestSomethingThatUsesAntiAffinityRuleRepository(t *testing.T) {

	// make and configure a mocked AntiAffinityRuleRepository
	mockedAntiAffinityRuleRepository := &AntiAffinityRuleRepositoryMock{
		ListByPathFunc: func(path Path) ([]AntiAffinityRule, error) {
			panic("mock out the ListByPath method")
		},
	}

	// use mockedAntiAffinityRuleRepository in code that requires AntiAffinityRuleRepository
	// and then make assertions.

}

func (*AntiAffinityRuleRepositoryMock) ListByPath

func (mock *AntiAffinityRuleRepositoryMock) ListByPath(path Path) ([]AntiAffinityRule, error)

ListByPath calls ListByPathFunc.

func (*AntiAffinityRuleRepositoryMock) ListByPathCalls

func (mock *AntiAffinityRuleRepositoryMock) ListByPathCalls() []struct {
	Path Path
}

ListByPathCalls gets all the calls that were made to ListByPath. Check the length with:

len(mockedAntiAffinityRuleRepository.ListByPathCalls())

type Name

type Name string

type Path

type Path string

func NewPath added in v0.4.0

func NewPath(path string) Path

type PathPrefix

type PathPrefix string

func (PathPrefix) Contains added in v0.3.0

func (p PathPrefix) Contains(path Path) bool

type RuleLabel added in v0.3.0

type RuleLabel string

type Violation

type Violation struct {
	ImportPath  Path
	PackagePath Path
	RuleLabel   RuleLabel
}

Violation represents why affinity rule is not fulfilled.

Jump to

Keyboard shortcuts

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