@@ -12,7 +12,10 @@ type ObjectListFilter =
1212 | Not of ObjectListFilter
1313 | Equals of FieldFilter < System.IComparable >
1414 | GreaterThan of FieldFilter < System.IComparable >
15+ | GreaterThanOrEqual of FieldFilter < System.IComparable >
1516 | LessThan of FieldFilter < System.IComparable >
17+ | LessThanOrEqual of FieldFilter < System.IComparable >
18+ | In of FieldFilter < System.IComparable list >
1619 | StartsWith of FieldFilter < string >
1720 | EndsWith of FieldFilter < string >
1821 | Contains of FieldFilter < string >
@@ -92,10 +95,16 @@ module ObjectListFilter =
9295 let ( = == ) fname value = Equals { FieldName = fname; Value = value }
9396
9497 /// Creates a new ObjectListFilter representing a GREATER THAN operation of a comparable value.
95- let ( = => ) fname value = GreaterThan { FieldName = fname; Value = value }
98+ let ( >>> ) fname value = GreaterThan { FieldName = fname; Value = value }
99+
100+ /// Creates a new ObjectListFilter representing a GREATER THAN OR EQUAL operation of a comparable value.
101+ let ( = => ) fname value = GreaterThanOrEqual { FieldName = fname; Value = value }
96102
97103 /// Creates a new ObjectListFilter representing a LESS THAN operation of a comparable value.
98- let ( <== ) fname value = LessThan { FieldName = fname; Value = value }
104+ let ( <<< ) fname value = LessThan { FieldName = fname ; Value = value }
105+
106+ /// Creates a new ObjectListFilter representing a LESS THAN OR EQUAL operation of a comparable value.
107+ let ( <== ) fname value = LessThanOrEqual { FieldName = fname ; Value = value }
99108
100109 /// Creates a new ObjectListFilter representing a STARTS WITH operation of a string value.
101110 let ( =@@ ) fname value = StartsWith { FieldName = fname ; Value = value }
@@ -106,6 +115,9 @@ module ObjectListFilter =
106115 /// Creates a new ObjectListFilter representing a CONTAINS operation.
107116 let ( @=@ ) fname value = Contains { FieldName = fname ; Value = value }
108117
118+ /// Creates a new ObjectListFilter representing a IN operation.
119+ let ( = ~= ) fname value = In { FieldName = fname ; Value = value }
120+
109121 /// Creates a new ObjectListFilter representing a field sub comparison.
110122 let ( - -> ) fname filter = FilterField { FieldName = fname ; Value = filter }
111123
@@ -169,6 +181,8 @@ module ObjectListFilter =
169181 | Equals f -> Expression.Equal ( Expression.PropertyOrField ( param, f.FieldName), Expression.Constant ( f.Value))
170182 | GreaterThan f -> Expression.GreaterThan ( Expression.PropertyOrField ( param, f.FieldName), Expression.Constant ( f.Value))
171183 | LessThan f -> Expression.LessThan ( Expression.PropertyOrField ( param, f.FieldName), Expression.Constant ( f.Value))
184+ | GreaterThanOrEqual f -> Expression.GreaterThanOrEqual ( Expression.PropertyOrField ( param, f.FieldName), Expression.Constant ( f.Value))
185+ | LessThanOrEqual f -> Expression.LessThanOrEqual ( Expression.PropertyOrField ( param, f.FieldName), Expression.Constant ( f.Value))
172186 | StartsWith f -> Expression.Call ( Expression.PropertyOrField ( param, f.FieldName), StringStartsWithMethod, Expression.Constant ( f.Value))
173187 | EndsWith f -> Expression.Call ( Expression.PropertyOrField ( param, f.FieldName), StringEndsWithMethod, Expression.Constant ( f.Value))
174188 | Contains f ->
@@ -201,6 +215,14 @@ module ObjectListFilter =
201215 Expression.Constant ( f.Value)
202216 )
203217 | _ -> Expression.Call ( `` member `` , StringContainsMethod, Expression.Constant ( f.Value))
218+ | In f ->
219+ let ``member`` = Expression.PropertyOrField ( param, f.FieldName)
220+ let values =
221+ f.Value
222+ |> List.map ( fun v -> Expression.Equal ( `` member `` , Expression.Constant ( v)))
223+ ( values
224+ |> List.reduce ( fun acc expr -> Expression.OrElse ( acc, expr)))
225+ :> Expression
204226 | OfTypes types ->
205227 types
206228 |> Seq.map ( fun t -> buildTypeDiscriminatorCheck param t)
@@ -222,26 +244,23 @@ module ObjectListFilter =
222244 Expression.PropertyOrField ( param, " __typename" ),
223245 // Default discriminator value
224246 Expression.Constant ( t.FullName)
225- )
226- :> Expression
247+ ) :> Expression
227248 | ValueSome discExpr, ValueNone ->
228249 Expression.Invoke (
229250 // Provided discriminator comparison
230251 discExpr,
231252 param,
232253 // Default discriminator value gathered from type
233- Expression.Constant ( t.FullName)
234- )
235- :> Expression
254+ Expression.Constant( t.FullName)
255+ ) :> Expression
236256 | ValueNone, ValueSome discValueFn ->
237257 let discriminatorValue = discValueFn t
238258 Expression.Equal (
239259 // Default discriminator property
240260 Expression.PropertyOrField ( param, " __typename" ),
241261 // Provided discriminator value gathered from type
242262 Expression.Constant ( discriminatorValue)
243- )
244- :> Expression
263+ ) :> Expression
245264 | ValueSome discExpr, ValueSome discValueFn ->
246265 let discriminatorValue = discValueFn t
247266 Expression.Invoke (
0 commit comments