| 1234567891011121314151617181920212223242526272829 | 
							- package valid
 
- import (
 
- 	"context"
 
- )
 
- // Validatable is the interface indicating the type implementing it supports data validation.
 
- type Validatable interface {
 
- 	// Validate validates the data and returns an error if validation fails.
 
- 	Validate() error
 
- }
 
- // ValidatableWithContext is the interface indicating the type implementing it supports context-aware data validation.
 
- type ValidatableWithContext interface {
 
- 	// ValidateWithContext validates the data with the given context and returns an error if validation fails.
 
- 	ValidateWithContext(ctx context.Context) error
 
- }
 
- // Rule represents a validation rule.
 
- type Rule interface {
 
- 	// Validate validates a value and returns a value if validation fails.
 
- 	Validate(value interface{}) error
 
- }
 
- // RuleWithContext represents a context-aware validation rule.
 
- type RuleWithContext interface {
 
- 	// ValidateWithContext validates a value and returns a value if validation fails.
 
- 	ValidateWithContext(ctx context.Context, value interface{}) error
 
- }
 
 
  |