github ↗
docs menu

Module Talon.Sel

Column selectors.

A selector chooses a set of columns by name, type or kind, without naming a schema. A verb resolves it against its input schema when it is applied, to an ordered list of distinct names. Expr.keep, Expr.across, Expr.each and Kit.drop take selectors; keys stay string list.

Selectors combine with (+), (-) and inter, written inside Sel.( … ): Sel.(prefix "wk" - names [ "wk76" ]).

#type t

The type for selectors.

Constructors

#val all : t

all selects every column, in schema order.

#val names : string list -> t

names ns selects the columns ns, in the order of ns. A name that appears twice is selected once, at its first position. A name the schema lacks is a problem.

#val prefix : string -> t

prefix p selects the columns whose name starts with p, in schema order.

#val suffix : string -> t

suffix s selects the columns whose name ends with s, in schema order.

#val of_kind : 'a Kind.t -> t

of_kind k selects the columns that a handle of kind k binds (see Kind.provably_equal), in schema order. It selects no extension column.

#val where : (string -> Type.any -> bool) -> t

where p selects the columns (n, t) for which p n t is true, in schema order. p must be pure; it runs when a verb is applied.

#val (+) : t -> t -> t

s0 + s1 selects s0's columns, then s1's columns not in s0.

#val (-) : t -> t -> t

s0 - s1 selects s0's columns that are not in s1, in s0's order.

#val inter : t -> t -> t

inter s0 s1 selects s0's columns that are in s1, in s0's order.