Module Table.Index

Table index descriptions.

This module provides a type to describe table indices.

Indices

type name = string

The type for index names.

type 'r t = 'r index

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

val v : ?unique:bool -> ?name:name -> 'r Col.v list -> 'r index

index 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 index -> 'r Col.v list

cols i are the columns indexed by i.

val unique : 'r index -> bool

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

val name : 'r index -> string option

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

val get_name : table_name:string -> 'r index -> 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.v list -> name

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