Module Table.Index

Table index definitionss.

This module provides a type to describe table indices.

Indices

type name = string

The type for index names.

type 'r t

The type for indices on a table with rows represented by 'r.

val make : ?unique:bool -> ?name:name -> 'r Col.def list -> 'r t

make cols ~name ~unique is an index named name on columns cols. If name is None a name is derived at index creation time from the table and column names. If unique is true (defaults to false) a UNIQUE constraint is added.

val cols : 'r t -> 'r Col.def list

cols i are the columns indexed by i.

val unique : 'r t -> bool

unique i is true if the values in index i must be unique.

val name : 'r t -> string option

name i is the name of i (if any).

val get_name : table_name:string -> 'r t -> string

get_name ~table_name i is the name of i assuming it is in table table_name, see auto_name.

val auto_name : table_name:string -> 'r Col.def list -> name

auto_name ~table_name cs is an index name derived from table_name and cs.