links

The Links Programming Language
IN THIS PACKAGE
Module Links_lens . Sort
type t
include Sexplib0.Sexpable.S with type t := t
val t_of_sexp : Sexplib0.Sexp.t -> t
val sexp_of_t : t -> Sexplib0.Sexp.t
val fds : t -> Fun_dep.Set.t

Get the functional dependencies

val predicate : t -> Phrase.t option

Get the predicate which defines all valid possible tuples

val query : t -> Phrase.t option

Get the predicate which is used for querying the database.

val cols : t -> Column.List.t

Get the list of columns belonging to the lens sort

val cols_present_aliases : t -> string list

Gets a list of the aliases of all present columns

val cols_present_aliases_set : t -> Alias.Set.t

Get a list of present aliases as a set.

val colset : t -> Column.Set.t

Get the columns as a set

val present_colset : t -> Column.Set.t

Get a set of the present columns

val make : ?fds:Fun_dep.Set.t -> ?predicate:Phrase.t option -> ?query:Phrase.t option -> Column.t list -> t

Construct a lens sort

val find_col_alias : t -> alias:string -> Column.t option

Find the column with the specified alias

val update_predicate : t -> query:Phrase.t option -> predicate:Phrase.t option -> t

Replace the predicate

val update_table_name : t -> table:string -> t

Update all columns with a table name

val set_serial : t -> columns:Alias.Set.t -> t

Change the specified columns to be of serial type.

val join_lens_should_swap : t -> t -> on:string list -> bool

Determines if the lenses should be swapped, because the right lens defines the left lens.

module Lens_sort_error : sig ... end
val lens_sort : fds:Fun_dep.Set.t -> columns:Column.List.t -> ( t, Lens_sort_error.t ) result
module Select_sort_error : sig ... end
val select_lens_sort_dynamic : t -> ( t, Select_sort_error.t ) result

Create a selection lens sort without checking the predicate.

val select_lens_sort : t -> predicate:Phrase.t -> ( t, Select_sort_error.t ) result

Create a selection lens using the specified predicate to filter records.

module Drop_sort_error : sig ... end
module Join_sort_error : sig ... end
val drop_lens_sort : t -> drop:Alias.t list -> default:Phrase.Value.t list -> key:Alias.Set.t -> ( t, Drop_sort_error.t ) result

Create a drop lens sort.

val join_lens_sort : t -> t -> on:(string * string * string) list -> ( t * (string * string * string) list, Join_sort_error.t ) result

Create a sort as the join of two other sorts on the columns specified by on

val record_type : t -> Links_lens__Phrase_type.t

Convert the sort into a phrase type.

val equal : t -> t -> bool