specification

package
v0.0.0-...-6db54d9 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: MIT Imports: 0 Imported by: 0

README

Спецификация (Specification)

Спецификация — шаблон проектирования, посредством которого представление правил бизнес логики может быть преобразовано в виде цепочки объектов, связанных операциями булевой логики.

Больше информации в Wikipedia https://en.wikipedia.org/wiki/Specification_pattern

-- THE END --

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AndSpecification

type AndSpecification struct {
	Specification
	// contains filtered or unexported fields
}

AndSpecification

func (*AndSpecification) IsSatisfiedBy

func (self *AndSpecification) IsSatisfiedBy(elm Invoice) bool

Check specification

type BaseSpecification

type BaseSpecification struct {
	Specification
}

Invoice BaseSpecification

func (*BaseSpecification) And

Condition AND

func (*BaseSpecification) IsSatisfiedBy

func (self *BaseSpecification) IsSatisfiedBy(elm Invoice) bool

Check specification

func (*BaseSpecification) Not

func (self *BaseSpecification) Not() Specification

Condition NOT

func (*BaseSpecification) Or

Condition OR

func (*BaseSpecification) Relate

func (self *BaseSpecification) Relate(spec Specification)

Relate to specification

type InCollectionSpecification

type InCollectionSpecification struct {
	Specification
}

Invoice has already been sent to the collection agency.

func (*InCollectionSpecification) IsSatisfiedBy

func (self *InCollectionSpecification) IsSatisfiedBy(elm Invoice) bool

Check specification

type Invoice

type Invoice struct {
	Day    int
	Notice int
	IsSent bool
}

Data for analysis

type NotSpecification

type NotSpecification struct {
	Specification
}

NotSpecification

func (*NotSpecification) IsSatisfiedBy

func (self *NotSpecification) IsSatisfiedBy(elm Invoice) bool

Check specification

type NoticeSentSpecification

type NoticeSentSpecification struct {
	Specification
}

Three notices have been sent to the customer

func (*NoticeSentSpecification) IsSatisfiedBy

func (self *NoticeSentSpecification) IsSatisfiedBy(elm Invoice) bool

Check specification

type OrSpecification

type OrSpecification struct {
	Specification
	// contains filtered or unexported fields
}

OrSpecification

func (*OrSpecification) IsSatisfiedBy

func (self *OrSpecification) IsSatisfiedBy(elm Invoice) bool

Check specification

type OverDueSpecification

type OverDueSpecification struct {
	Specification
}

Invoice's due date is 30 days or older

func (*OverDueSpecification) IsSatisfiedBy

func (self *OverDueSpecification) IsSatisfiedBy(elm Invoice) bool

Check specification

type Specification

type Specification interface {
	IsSatisfiedBy(Invoice) bool
	And(Specification) Specification
	Or(Specification) Specification
	Not() Specification
	Relate(Specification)
}

Invoice Specification Interface

func NewInCollectionSpecification

func NewInCollectionSpecification() Specification

Constructor

func NewNoticeSentSpecification

func NewNoticeSentSpecification() Specification

Constructor

func NewOverDueSpecification

func NewOverDueSpecification() Specification

Constructor

Jump to

Keyboard shortcuts

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