Skip to content

Commit 7ce0f96

Browse files
committed
Support json.Number values, more docs
1 parent ce0c397 commit 7ce0f96

File tree

3 files changed

+132
-65
lines changed

3 files changed

+132
-65
lines changed

spec/filter.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ type BasicExpr interface {
2626
// LogicalAnd represents a list of one or more expressions ANDed together by
2727
// the && operator. Evaluates to true if all of its expressions evaluate to
2828
// true. Short-circuits and returns false for the first expression that
29-
// returns false. Implements [BasicExpr] and [fmt.Stringer].
29+
// returns false. Interfaces implemented:
30+
//
31+
// - [BasicExpr]
32+
// - [fmt.Stringer]
3033
type LogicalAnd []BasicExpr
3134

3235
// And creates a LogicalAnd of all expr.
@@ -122,19 +125,17 @@ func (lo LogicalOr) ResultType() FuncType {
122125
}
123126

124127
// ParenExpr represents a parenthesized expression that groups the elements of
125-
// a [LogicalOr].
126-
//
127-
// Interfaces implemented (via the underlying [LogicalOr]):
128+
// a [LogicalOr]. Interfaces implemented (via the underlying [LogicalOr]):
128129
// - [BasicExpr]
129130
// - [FuncExprArg]
130131
// - [fmt.Stringer]
131132
type ParenExpr struct {
132133
LogicalOr
133134
}
134135

135-
// Paren returns a new ParenExpr that ORs each and.
136-
func Paren(and ...LogicalAnd) *ParenExpr {
137-
return &ParenExpr{LogicalOr: LogicalOr(and)}
136+
// Paren returns a new ParenExpr that ORs the results of each expr.
137+
func Paren(expr ...LogicalAnd) *ParenExpr {
138+
return &ParenExpr{LogicalOr: LogicalOr(expr)}
138139
}
139140

140141
// writeTo writes a string representation of p to buf. Defined by
@@ -153,7 +154,7 @@ func (p *ParenExpr) String() string {
153154
}
154155

155156
// NotParenExpr represents a negated parenthesized expression that groups the
156-
// elements of a [LogicalOr] Interfaces implemented (via the underlying
157+
// elements of a [LogicalOr]. Interfaces implemented (via the underlying
157158
// [LogicalOr]):
158159
// - [BasicExpr]
159160
// - [FuncExprArg]
@@ -162,9 +163,9 @@ type NotParenExpr struct {
162163
LogicalOr
163164
}
164165

165-
// NotParen returns a new NotParenExpr that ORs each and.
166-
func NotParen(and ...LogicalAnd) *NotParenExpr {
167-
return &NotParenExpr{LogicalOr: LogicalOr(and)}
166+
// NotParen returns a new NotParenExpr that ORs each expr.
167+
func NotParen(expr ...LogicalAnd) *NotParenExpr {
168+
return &NotParenExpr{LogicalOr: LogicalOr(expr)}
168169
}
169170

170171
// writeTo writes a string representation of p to buf. Defined by
@@ -198,7 +199,7 @@ type ExistExpr struct {
198199
*PathQuery
199200
}
200201

201-
// Existence creates a new [ExistExpr].
202+
// Existence creates a new [ExistExpr] for q.
202203
func Existence(q *PathQuery) *ExistExpr {
203204
return &ExistExpr{PathQuery: q}
204205
}
@@ -225,7 +226,7 @@ type NonExistExpr struct {
225226
*PathQuery
226227
}
227228

228-
// Nonexistence creates a new [NonExistExpr].
229+
// Nonexistence creates a new [NonExistExpr] for q.
229230
func Nonexistence(q *PathQuery) *NonExistExpr {
230231
return &NonExistExpr{PathQuery: q}
231232
}

0 commit comments

Comments
 (0)