-
Notifications
You must be signed in to change notification settings - Fork 0
/
c_or.go
44 lines (35 loc) · 807 Bytes
/
c_or.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package constraint
import (
schema "github.com/jsightapi/jsight-schema-core"
"github.com/jsightapi/jsight-schema-core/json"
)
// Or constraint.
// Used for compile-time checking.
type Or struct {
source schema.RuleASTNodeSource
}
var (
_ Constraint = Or{}
_ Constraint = (*Or)(nil)
)
func NewOr(s schema.RuleASTNodeSource) *Or {
return &Or{
source: s,
}
}
func (c Or) IsGenerated() bool {
return c.source == schema.RuleASTNodeSourceGenerated
}
func (Or) IsJsonTypeCompatible(json.Type) bool {
return true
}
func (Or) Type() Type {
return OrConstraintType
}
func (Or) String() string {
return "[ UNVERIFIABLE CONSTRAINT ] " + OrConstraintType.String()
}
func (Or) ASTNode() schema.RuleASTNode {
// Check `collectASTRules` function for the actual logic.
return newEmptyRuleASTNode()
}