Documentation
¶
Overview ¶
Package constraint provides PSL constraint language for field relationships.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Constraint ¶
type Constraint struct {
Type ConstraintType `json:"type"`
Expression string `json:"expression"`
Fields []string `json:"fields"`
Message string `json:"message"`
}
Constraint defines a field constraint.
type ConstraintBlock ¶
type ConstraintBlock struct {
Protocol string `json:"protocol"`
Constraints []Constraint `json:"constraints"`
}
ConstraintBlock holds constraints for a protocol.
func NewBlock ¶
func NewBlock(protocol string) *ConstraintBlock
NewBlock creates a new constraint block.
func (*ConstraintBlock) AddArithmetic ¶
func (cb *ConstraintBlock) AddArithmetic(expr string, fields []string) *ConstraintBlock
AddArithmetic adds an arithmetic constraint.
func (*ConstraintBlock) AddReference ¶
func (cb *ConstraintBlock) AddReference(expr string, fields []string) *ConstraintBlock
AddReference adds a reference constraint (e.g., checksum).
func (*ConstraintBlock) Describe ¶
func (cb *ConstraintBlock) Describe() string
Describe returns a human-readable description.
type ConstraintType ¶
type ConstraintType string
ConstraintType represents the type of constraint.
const ( Arithmetic ConstraintType = "arithmetic" Reference ConstraintType = "reference" Range ConstraintType = "range_check" Custom ConstraintType = "custom" )
Click to show internal directories.
Click to hide internal directories.