Documentation
¶
Overview ¶
Package specification implements Specification tactical pattern. Validations are implemented as separate structs, each sharing a common interface that defines a single function. This allows us to utilize multiple, reusable validation rules independently. The `validUsers()` function remains unchanged while supporting different validation logic, leveraging polymorphism via injected specification dependencies. This approach adheres to the Open/Closed Principle — allowing behavior extension without modifying the existing code.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EmailValidation ¶
type EmailValidation struct{}
func (EmailValidation) IsValid ¶
func (ev EmailValidation) IsValid(entry *UserEntry) bool
type NameValidation ¶
type NameValidation struct{}
func (NameValidation) IsValid ¶
func (nv NameValidation) IsValid(entry *UserEntry) bool
type PhoneValidation ¶
type PhoneValidation struct{}
PhoneValidation is a specific Specification implementation
func (PhoneValidation) IsValid ¶
func (pv PhoneValidation) IsValid(entry *UserEntry) bool
type Validation ¶
Validation is the common Specification interface
Click to show internal directories.
Click to hide internal directories.