()
| 1628 | } |
| 1629 | |
| 1630 | func (c *PermanodeConstraint) checkValid() error { |
| 1631 | if c == nil { |
| 1632 | return nil |
| 1633 | } |
| 1634 | if c.Attr != "" { |
| 1635 | if c.NumValue == nil && !c.hasValueConstraint() { |
| 1636 | return errors.New("PermanodeConstraint with Attr requires also setting NumValue or a value-matching constraint") |
| 1637 | } |
| 1638 | if nv := c.NumValue; nv != nil { |
| 1639 | if nv.ZeroMin { |
| 1640 | return errors.New("NumValue with ZeroMin makes no sense; matches everything") |
| 1641 | } |
| 1642 | if nv.ZeroMax && c.hasValueConstraint() { |
| 1643 | return errors.New("NumValue with ZeroMax makes no sense in conjunction with a value-matching constraint; matches nothing") |
| 1644 | } |
| 1645 | if nv.Min < 0 || nv.Max < 0 { |
| 1646 | return errors.New("NumValue with negative Min or Max makes no sense") |
| 1647 | } |
| 1648 | } |
| 1649 | } |
| 1650 | if rc := c.Relation; rc != nil { |
| 1651 | if err := rc.checkValid(); err != nil { |
| 1652 | return err |
| 1653 | } |
| 1654 | } |
| 1655 | if pcc := c.Continue; pcc != nil { |
| 1656 | if err := pcc.checkValid(); err != nil { |
| 1657 | return err |
| 1658 | } |
| 1659 | } |
| 1660 | return nil |
| 1661 | } |
| 1662 | |
| 1663 | var numPermanodeFields = reflect.TypeOf(PermanodeConstraint{}).NumField() |
| 1664 |
nothing calls this directly
no test coverage detected