| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Rel8.Internal.Table.Name
Synopsis
- namesFromLabels :: Table Name a => a
- namesFromLabelsTagged :: Table Name a => Tag -> a
- namesFromLabelsWith :: Table Name a => (NonEmpty String -> String) -> a
- namesFromLabelsWithA :: (Apply f, Table Name a) => (NonEmpty String -> f String) -> f a
- showLabels :: Table (Context a) a => a -> [NonEmpty String]
- showNames :: Table Name a => a -> NonEmpty String
- shortenName :: Maybe Tag -> NonEmpty String -> State Tag String
Documentation
namesFromLabels :: Table Name a => a Source #
Construct a table in the Name context containing the names of all
columns. Nested column names will be combined with /, the resulting
name will be truncated and a unique tag appended to the end of the name
so that the resulting name has 63 or less characters (Postgres' default
maximum column name length).
See also: namesFromLabelsTagged, namesFromLabelsWith.
namesFromLabelsTagged :: Table Name a => Tag -> a Source #
Similar to namesFromLabels, but receives an additional Tag
to distinguish between relations. Resulting names will also have 63 or
less characters.
namesFromLabelsWith :: Table Name a => (NonEmpty String -> String) -> a Source #
Construct a table in the Name context containing the names of all
columns. The supplied function can be used to transform column names.
This function can be used to generically derive the columns for a
TableSchema. For example,
myTableSchema :: TableSchema (MyTable Name)
myTableSchema = TableSchema
{ columns = namesFromLabelsWith last
}
will construct a TableSchema where each columns names exactly corresponds
to the name of the Haskell field.