aboutsummaryrefslogtreecommitdiff
path: root/lib/expression/t.mli
blob: 840805de45f2eb02c42e3f4c3191f630b2267e7a (plain)
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
45
46
47
48
49
50
51
52
53
54
type 'a window =
  | Min of 'a
  | Max of 'a
  | Counter
  | Previous of 'a
  | Sum of 'a

type 'a t =
  | Empty
  | Expr of 'a t
  | Literal of string
  | Integer of string
  | Path of 'a
  | Concat of 'a t list
  | Function of string * 'a t list
  | Nvl of 'a t list
  | Join of string * 'a t list
  | Window of ('a t window * 'a t list * 'a t list)
  | BOperator of binary_operator * 'a t * 'a t
  | GEquality of binary_operator * 'a t * 'a t list
  | Function' of funct * 'a t list

and binary_operator =
  | Equal
  | Different
  | Add
  | Minus
  | Division
  | LT
  | GT
  | And
  | Or

and funct =
  | Upper
  | Trim

val cmp : ('a -> 'a -> int) -> 'a t -> 'a t -> int
(** Compare two expressions *)

val fold_values : f:('b -> 'a -> 'b) -> init:'b -> 'a t -> 'b
(** Fold over all the path presents inside the expression. Used for example to
    identify all the columns to extract from the file. 

    The order is not guarantee to follow the order from the expression *)

val map : f:('a -> 'b) -> 'a t -> 'b t
(** The map function. Mainly used in the configuration migration. *)

val name_of_operator : binary_operator -> string
val name_of_window : 'a window -> string
val map_window : f:('a -> 'b) -> 'a window -> 'b window
val window_of_name : string -> 'a option -> 'a window
val name_of_function : funct -> string