{-# LANGUAGE DeriveLift #-}

-- | This module contains types and functions for working with and
-- disambiguating database and Haskell names.
--
-- @since 2.13.0.0
module Database.Persist.Names where

import Data.Text (Text)
import Language.Haskell.TH.Syntax (Lift)
-- Bring `Lift (Map k v)` instance into scope, as well as `Lift Text`
-- instance on pre-1.2.4 versions of `text`
import Instances.TH.Lift ()

-- | Convenience operations for working with '-NameDB' types.
--
-- @since 2.12.0.0
class DatabaseName a where
    escapeWith :: (Text -> str) -> (a -> str)

-- | An 'EntityNameDB' represents the datastore-side name that @persistent@
-- will use for an entity.
--
-- @since 2.12.0.0
newtype FieldNameDB = FieldNameDB { FieldNameDB -> Text
unFieldNameDB :: Text }
    deriving (Int -> FieldNameDB -> ShowS
[FieldNameDB] -> ShowS
FieldNameDB -> String
(Int -> FieldNameDB -> ShowS)
-> (FieldNameDB -> String)
-> ([FieldNameDB] -> ShowS)
-> Show FieldNameDB
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FieldNameDB] -> ShowS
$cshowList :: [FieldNameDB] -> ShowS
show :: FieldNameDB -> String
$cshow :: FieldNameDB -> String
showsPrec :: Int -> FieldNameDB -> ShowS
$cshowsPrec :: Int -> FieldNameDB -> ShowS
Show, FieldNameDB -> FieldNameDB -> Bool
(FieldNameDB -> FieldNameDB -> Bool)
-> (FieldNameDB -> FieldNameDB -> Bool) -> Eq FieldNameDB
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FieldNameDB -> FieldNameDB -> Bool
$c/= :: FieldNameDB -> FieldNameDB -> Bool
== :: FieldNameDB -> FieldNameDB -> Bool
$c== :: FieldNameDB -> FieldNameDB -> Bool
Eq, ReadPrec [FieldNameDB]
ReadPrec FieldNameDB
Int -> ReadS FieldNameDB
ReadS [FieldNameDB]
(Int -> ReadS FieldNameDB)
-> ReadS [FieldNameDB]
-> ReadPrec FieldNameDB
-> ReadPrec [FieldNameDB]
-> Read FieldNameDB
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FieldNameDB]
$creadListPrec :: ReadPrec [FieldNameDB]
readPrec :: ReadPrec FieldNameDB
$creadPrec :: ReadPrec FieldNameDB
readList :: ReadS [FieldNameDB]
$creadList :: ReadS [FieldNameDB]
readsPrec :: Int -> ReadS FieldNameDB
$creadsPrec :: Int -> ReadS FieldNameDB
Read, Eq FieldNameDB
Eq FieldNameDB
-> (FieldNameDB -> FieldNameDB -> Ordering)
-> (FieldNameDB -> FieldNameDB -> Bool)
-> (FieldNameDB -> FieldNameDB -> Bool)
-> (FieldNameDB -> FieldNameDB -> Bool)
-> (FieldNameDB -> FieldNameDB -> Bool)
-> (FieldNameDB -> FieldNameDB -> FieldNameDB)
-> (FieldNameDB -> FieldNameDB -> FieldNameDB)
-> Ord FieldNameDB
FieldNameDB -> FieldNameDB -> Bool
FieldNameDB -> FieldNameDB -> Ordering
FieldNameDB -> FieldNameDB -> FieldNameDB
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: FieldNameDB -> FieldNameDB -> FieldNameDB
$cmin :: FieldNameDB -> FieldNameDB -> FieldNameDB
max :: FieldNameDB -> FieldNameDB -> FieldNameDB
$cmax :: FieldNameDB -> FieldNameDB -> FieldNameDB
>= :: FieldNameDB -> FieldNameDB -> Bool
$c>= :: FieldNameDB -> FieldNameDB -> Bool
> :: FieldNameDB -> FieldNameDB -> Bool
$c> :: FieldNameDB -> FieldNameDB -> Bool
<= :: FieldNameDB -> FieldNameDB -> Bool
$c<= :: FieldNameDB -> FieldNameDB -> Bool
< :: FieldNameDB -> FieldNameDB -> Bool
$c< :: FieldNameDB -> FieldNameDB -> Bool
compare :: FieldNameDB -> FieldNameDB -> Ordering
$ccompare :: FieldNameDB -> FieldNameDB -> Ordering
$cp1Ord :: Eq FieldNameDB
Ord, FieldNameDB -> Q Exp
FieldNameDB -> Q (TExp FieldNameDB)
(FieldNameDB -> Q Exp)
-> (FieldNameDB -> Q (TExp FieldNameDB)) -> Lift FieldNameDB
forall t. (t -> Q Exp) -> (t -> Q (TExp t)) -> Lift t
liftTyped :: FieldNameDB -> Q (TExp FieldNameDB)
$cliftTyped :: FieldNameDB -> Q (TExp FieldNameDB)
lift :: FieldNameDB -> Q Exp
$clift :: FieldNameDB -> Q Exp
Lift)

-- | @since 2.12.0.0
instance DatabaseName FieldNameDB where
    escapeWith :: (Text -> str) -> FieldNameDB -> str
escapeWith Text -> str
f (FieldNameDB Text
n) = Text -> str
f Text
n

-- | A 'FieldNameHS' represents the Haskell-side name that @persistent@
-- will use for a field.
--
-- @since 2.12.0.0
newtype FieldNameHS = FieldNameHS { FieldNameHS -> Text
unFieldNameHS :: Text }
    deriving (Int -> FieldNameHS -> ShowS
[FieldNameHS] -> ShowS
FieldNameHS -> String
(Int -> FieldNameHS -> ShowS)
-> (FieldNameHS -> String)
-> ([FieldNameHS] -> ShowS)
-> Show FieldNameHS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FieldNameHS] -> ShowS
$cshowList :: [FieldNameHS] -> ShowS
show :: FieldNameHS -> String
$cshow :: FieldNameHS -> String
showsPrec :: Int -> FieldNameHS -> ShowS
$cshowsPrec :: Int -> FieldNameHS -> ShowS
Show, FieldNameHS -> FieldNameHS -> Bool
(FieldNameHS -> FieldNameHS -> Bool)
-> (FieldNameHS -> FieldNameHS -> Bool) -> Eq FieldNameHS
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FieldNameHS -> FieldNameHS -> Bool
$c/= :: FieldNameHS -> FieldNameHS -> Bool
== :: FieldNameHS -> FieldNameHS -> Bool
$c== :: FieldNameHS -> FieldNameHS -> Bool
Eq, ReadPrec [FieldNameHS]
ReadPrec FieldNameHS
Int -> ReadS FieldNameHS
ReadS [FieldNameHS]
(Int -> ReadS FieldNameHS)
-> ReadS [FieldNameHS]
-> ReadPrec FieldNameHS
-> ReadPrec [FieldNameHS]
-> Read FieldNameHS
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FieldNameHS]
$creadListPrec :: ReadPrec [FieldNameHS]
readPrec :: ReadPrec FieldNameHS
$creadPrec :: ReadPrec FieldNameHS
readList :: ReadS [FieldNameHS]
$creadList :: ReadS [FieldNameHS]
readsPrec :: Int -> ReadS FieldNameHS
$creadsPrec :: Int -> ReadS FieldNameHS
Read, Eq FieldNameHS
Eq FieldNameHS
-> (FieldNameHS -> FieldNameHS -> Ordering)
-> (FieldNameHS -> FieldNameHS -> Bool)
-> (FieldNameHS -> FieldNameHS -> Bool)
-> (FieldNameHS -> FieldNameHS -> Bool)
-> (FieldNameHS -> FieldNameHS -> Bool)
-> (FieldNameHS -> FieldNameHS -> FieldNameHS)
-> (FieldNameHS -> FieldNameHS -> FieldNameHS)
-> Ord FieldNameHS
FieldNameHS -> FieldNameHS -> Bool
FieldNameHS -> FieldNameHS -> Ordering
FieldNameHS -> FieldNameHS -> FieldNameHS
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: FieldNameHS -> FieldNameHS -> FieldNameHS
$cmin :: FieldNameHS -> FieldNameHS -> FieldNameHS
max :: FieldNameHS -> FieldNameHS -> FieldNameHS
$cmax :: FieldNameHS -> FieldNameHS -> FieldNameHS
>= :: FieldNameHS -> FieldNameHS -> Bool
$c>= :: FieldNameHS -> FieldNameHS -> Bool
> :: FieldNameHS -> FieldNameHS -> Bool
$c> :: FieldNameHS -> FieldNameHS -> Bool
<= :: FieldNameHS -> FieldNameHS -> Bool
$c<= :: FieldNameHS -> FieldNameHS -> Bool
< :: FieldNameHS -> FieldNameHS -> Bool
$c< :: FieldNameHS -> FieldNameHS -> Bool
compare :: FieldNameHS -> FieldNameHS -> Ordering
$ccompare :: FieldNameHS -> FieldNameHS -> Ordering
$cp1Ord :: Eq FieldNameHS
Ord, FieldNameHS -> Q Exp
FieldNameHS -> Q (TExp FieldNameHS)
(FieldNameHS -> Q Exp)
-> (FieldNameHS -> Q (TExp FieldNameHS)) -> Lift FieldNameHS
forall t. (t -> Q Exp) -> (t -> Q (TExp t)) -> Lift t
liftTyped :: FieldNameHS -> Q (TExp FieldNameHS)
$cliftTyped :: FieldNameHS -> Q (TExp FieldNameHS)
lift :: FieldNameHS -> Q Exp
$clift :: FieldNameHS -> Q Exp
Lift)

-- | An 'EntityNameHS' represents the Haskell-side name that @persistent@
-- will use for an entity.
--
-- @since 2.12.0.0
newtype EntityNameHS = EntityNameHS { EntityNameHS -> Text
unEntityNameHS :: Text }
    deriving (Int -> EntityNameHS -> ShowS
[EntityNameHS] -> ShowS
EntityNameHS -> String
(Int -> EntityNameHS -> ShowS)
-> (EntityNameHS -> String)
-> ([EntityNameHS] -> ShowS)
-> Show EntityNameHS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EntityNameHS] -> ShowS
$cshowList :: [EntityNameHS] -> ShowS
show :: EntityNameHS -> String
$cshow :: EntityNameHS -> String
showsPrec :: Int -> EntityNameHS -> ShowS
$cshowsPrec :: Int -> EntityNameHS -> ShowS
Show, EntityNameHS -> EntityNameHS -> Bool
(EntityNameHS -> EntityNameHS -> Bool)
-> (EntityNameHS -> EntityNameHS -> Bool) -> Eq EntityNameHS
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EntityNameHS -> EntityNameHS -> Bool
$c/= :: EntityNameHS -> EntityNameHS -> Bool
== :: EntityNameHS -> EntityNameHS -> Bool
$c== :: EntityNameHS -> EntityNameHS -> Bool
Eq, ReadPrec [EntityNameHS]
ReadPrec EntityNameHS
Int -> ReadS EntityNameHS
ReadS [EntityNameHS]
(Int -> ReadS EntityNameHS)
-> ReadS [EntityNameHS]
-> ReadPrec EntityNameHS
-> ReadPrec [EntityNameHS]
-> Read EntityNameHS
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EntityNameHS]
$creadListPrec :: ReadPrec [EntityNameHS]
readPrec :: ReadPrec EntityNameHS
$creadPrec :: ReadPrec EntityNameHS
readList :: ReadS [EntityNameHS]
$creadList :: ReadS [EntityNameHS]
readsPrec :: Int -> ReadS EntityNameHS
$creadsPrec :: Int -> ReadS EntityNameHS
Read, Eq EntityNameHS
Eq EntityNameHS
-> (EntityNameHS -> EntityNameHS -> Ordering)
-> (EntityNameHS -> EntityNameHS -> Bool)
-> (EntityNameHS -> EntityNameHS -> Bool)
-> (EntityNameHS -> EntityNameHS -> Bool)
-> (EntityNameHS -> EntityNameHS -> Bool)
-> (EntityNameHS -> EntityNameHS -> EntityNameHS)
-> (EntityNameHS -> EntityNameHS -> EntityNameHS)
-> Ord EntityNameHS
EntityNameHS -> EntityNameHS -> Bool
EntityNameHS -> EntityNameHS -> Ordering
EntityNameHS -> EntityNameHS -> EntityNameHS
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: EntityNameHS -> EntityNameHS -> EntityNameHS
$cmin :: EntityNameHS -> EntityNameHS -> EntityNameHS
max :: EntityNameHS -> EntityNameHS -> EntityNameHS
$cmax :: EntityNameHS -> EntityNameHS -> EntityNameHS
>= :: EntityNameHS -> EntityNameHS -> Bool
$c>= :: EntityNameHS -> EntityNameHS -> Bool
> :: EntityNameHS -> EntityNameHS -> Bool
$c> :: EntityNameHS -> EntityNameHS -> Bool
<= :: EntityNameHS -> EntityNameHS -> Bool
$c<= :: EntityNameHS -> EntityNameHS -> Bool
< :: EntityNameHS -> EntityNameHS -> Bool
$c< :: EntityNameHS -> EntityNameHS -> Bool
compare :: EntityNameHS -> EntityNameHS -> Ordering
$ccompare :: EntityNameHS -> EntityNameHS -> Ordering
$cp1Ord :: Eq EntityNameHS
Ord, EntityNameHS -> Q Exp
EntityNameHS -> Q (TExp EntityNameHS)
(EntityNameHS -> Q Exp)
-> (EntityNameHS -> Q (TExp EntityNameHS)) -> Lift EntityNameHS
forall t. (t -> Q Exp) -> (t -> Q (TExp t)) -> Lift t
liftTyped :: EntityNameHS -> Q (TExp EntityNameHS)
$cliftTyped :: EntityNameHS -> Q (TExp EntityNameHS)
lift :: EntityNameHS -> Q Exp
$clift :: EntityNameHS -> Q Exp
Lift)

-- | An 'EntityNameDB' represents the datastore-side name that @persistent@
-- will use for an entity.
--
-- @since 2.12.0.0
newtype EntityNameDB = EntityNameDB { EntityNameDB -> Text
unEntityNameDB :: Text }
    deriving (Int -> EntityNameDB -> ShowS
[EntityNameDB] -> ShowS
EntityNameDB -> String
(Int -> EntityNameDB -> ShowS)
-> (EntityNameDB -> String)
-> ([EntityNameDB] -> ShowS)
-> Show EntityNameDB
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EntityNameDB] -> ShowS
$cshowList :: [EntityNameDB] -> ShowS
show :: EntityNameDB -> String
$cshow :: EntityNameDB -> String
showsPrec :: Int -> EntityNameDB -> ShowS
$cshowsPrec :: Int -> EntityNameDB -> ShowS
Show, EntityNameDB -> EntityNameDB -> Bool
(EntityNameDB -> EntityNameDB -> Bool)
-> (EntityNameDB -> EntityNameDB -> Bool) -> Eq EntityNameDB
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EntityNameDB -> EntityNameDB -> Bool
$c/= :: EntityNameDB -> EntityNameDB -> Bool
== :: EntityNameDB -> EntityNameDB -> Bool
$c== :: EntityNameDB -> EntityNameDB -> Bool
Eq, ReadPrec [EntityNameDB]
ReadPrec EntityNameDB
Int -> ReadS EntityNameDB
ReadS [EntityNameDB]
(Int -> ReadS EntityNameDB)
-> ReadS [EntityNameDB]
-> ReadPrec EntityNameDB
-> ReadPrec [EntityNameDB]
-> Read EntityNameDB
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EntityNameDB]
$creadListPrec :: ReadPrec [EntityNameDB]
readPrec :: ReadPrec EntityNameDB
$creadPrec :: ReadPrec EntityNameDB
readList :: ReadS [EntityNameDB]
$creadList :: ReadS [EntityNameDB]
readsPrec :: Int -> ReadS EntityNameDB
$creadsPrec :: Int -> ReadS EntityNameDB
Read, Eq EntityNameDB
Eq EntityNameDB
-> (EntityNameDB -> EntityNameDB -> Ordering)
-> (EntityNameDB -> EntityNameDB -> Bool)
-> (EntityNameDB -> EntityNameDB -> Bool)
-> (EntityNameDB -> EntityNameDB -> Bool)
-> (EntityNameDB -> EntityNameDB -> Bool)
-> (EntityNameDB -> EntityNameDB -> EntityNameDB)
-> (EntityNameDB -> EntityNameDB -> EntityNameDB)
-> Ord EntityNameDB
EntityNameDB -> EntityNameDB -> Bool
EntityNameDB -> EntityNameDB -> Ordering
EntityNameDB -> EntityNameDB -> EntityNameDB
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: EntityNameDB -> EntityNameDB -> EntityNameDB
$cmin :: EntityNameDB -> EntityNameDB -> EntityNameDB
max :: EntityNameDB -> EntityNameDB -> EntityNameDB
$cmax :: EntityNameDB -> EntityNameDB -> EntityNameDB
>= :: EntityNameDB -> EntityNameDB -> Bool
$c>= :: EntityNameDB -> EntityNameDB -> Bool
> :: EntityNameDB -> EntityNameDB -> Bool
$c> :: EntityNameDB -> EntityNameDB -> Bool
<= :: EntityNameDB -> EntityNameDB -> Bool
$c<= :: EntityNameDB -> EntityNameDB -> Bool
< :: EntityNameDB -> EntityNameDB -> Bool
$c< :: EntityNameDB -> EntityNameDB -> Bool
compare :: EntityNameDB -> EntityNameDB -> Ordering
$ccompare :: EntityNameDB -> EntityNameDB -> Ordering
$cp1Ord :: Eq EntityNameDB
Ord, EntityNameDB -> Q Exp
EntityNameDB -> Q (TExp EntityNameDB)
(EntityNameDB -> Q Exp)
-> (EntityNameDB -> Q (TExp EntityNameDB)) -> Lift EntityNameDB
forall t. (t -> Q Exp) -> (t -> Q (TExp t)) -> Lift t
liftTyped :: EntityNameDB -> Q (TExp EntityNameDB)
$cliftTyped :: EntityNameDB -> Q (TExp EntityNameDB)
lift :: EntityNameDB -> Q Exp
$clift :: EntityNameDB -> Q Exp
Lift)

instance DatabaseName EntityNameDB where
    escapeWith :: (Text -> str) -> EntityNameDB -> str
escapeWith Text -> str
f (EntityNameDB Text
n) = Text -> str
f Text
n

-- | A 'ConstraintNameDB' represents the datastore-side name that @persistent@
-- will use for a constraint.
--
-- @since 2.12.0.0
newtype ConstraintNameDB = ConstraintNameDB { ConstraintNameDB -> Text
unConstraintNameDB :: Text }
  deriving (Int -> ConstraintNameDB -> ShowS
[ConstraintNameDB] -> ShowS
ConstraintNameDB -> String
(Int -> ConstraintNameDB -> ShowS)
-> (ConstraintNameDB -> String)
-> ([ConstraintNameDB] -> ShowS)
-> Show ConstraintNameDB
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConstraintNameDB] -> ShowS
$cshowList :: [ConstraintNameDB] -> ShowS
show :: ConstraintNameDB -> String
$cshow :: ConstraintNameDB -> String
showsPrec :: Int -> ConstraintNameDB -> ShowS
$cshowsPrec :: Int -> ConstraintNameDB -> ShowS
Show, ConstraintNameDB -> ConstraintNameDB -> Bool
(ConstraintNameDB -> ConstraintNameDB -> Bool)
-> (ConstraintNameDB -> ConstraintNameDB -> Bool)
-> Eq ConstraintNameDB
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConstraintNameDB -> ConstraintNameDB -> Bool
$c/= :: ConstraintNameDB -> ConstraintNameDB -> Bool
== :: ConstraintNameDB -> ConstraintNameDB -> Bool
$c== :: ConstraintNameDB -> ConstraintNameDB -> Bool
Eq, ReadPrec [ConstraintNameDB]
ReadPrec ConstraintNameDB
Int -> ReadS ConstraintNameDB
ReadS [ConstraintNameDB]
(Int -> ReadS ConstraintNameDB)
-> ReadS [ConstraintNameDB]
-> ReadPrec ConstraintNameDB
-> ReadPrec [ConstraintNameDB]
-> Read ConstraintNameDB
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConstraintNameDB]
$creadListPrec :: ReadPrec [ConstraintNameDB]
readPrec :: ReadPrec ConstraintNameDB
$creadPrec :: ReadPrec ConstraintNameDB
readList :: ReadS [ConstraintNameDB]
$creadList :: ReadS [ConstraintNameDB]
readsPrec :: Int -> ReadS ConstraintNameDB
$creadsPrec :: Int -> ReadS ConstraintNameDB
Read, Eq ConstraintNameDB
Eq ConstraintNameDB
-> (ConstraintNameDB -> ConstraintNameDB -> Ordering)
-> (ConstraintNameDB -> ConstraintNameDB -> Bool)
-> (ConstraintNameDB -> ConstraintNameDB -> Bool)
-> (ConstraintNameDB -> ConstraintNameDB -> Bool)
-> (ConstraintNameDB -> ConstraintNameDB -> Bool)
-> (ConstraintNameDB -> ConstraintNameDB -> ConstraintNameDB)
-> (ConstraintNameDB -> ConstraintNameDB -> ConstraintNameDB)
-> Ord ConstraintNameDB
ConstraintNameDB -> ConstraintNameDB -> Bool
ConstraintNameDB -> ConstraintNameDB -> Ordering
ConstraintNameDB -> ConstraintNameDB -> ConstraintNameDB
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ConstraintNameDB -> ConstraintNameDB -> ConstraintNameDB
$cmin :: ConstraintNameDB -> ConstraintNameDB -> ConstraintNameDB
max :: ConstraintNameDB -> ConstraintNameDB -> ConstraintNameDB
$cmax :: ConstraintNameDB -> ConstraintNameDB -> ConstraintNameDB
>= :: ConstraintNameDB -> ConstraintNameDB -> Bool
$c>= :: ConstraintNameDB -> ConstraintNameDB -> Bool
> :: ConstraintNameDB -> ConstraintNameDB -> Bool
$c> :: ConstraintNameDB -> ConstraintNameDB -> Bool
<= :: ConstraintNameDB -> ConstraintNameDB -> Bool
$c<= :: ConstraintNameDB -> ConstraintNameDB -> Bool
< :: ConstraintNameDB -> ConstraintNameDB -> Bool
$c< :: ConstraintNameDB -> ConstraintNameDB -> Bool
compare :: ConstraintNameDB -> ConstraintNameDB -> Ordering
$ccompare :: ConstraintNameDB -> ConstraintNameDB -> Ordering
$cp1Ord :: Eq ConstraintNameDB
Ord, ConstraintNameDB -> Q Exp
ConstraintNameDB -> Q (TExp ConstraintNameDB)
(ConstraintNameDB -> Q Exp)
-> (ConstraintNameDB -> Q (TExp ConstraintNameDB))
-> Lift ConstraintNameDB
forall t. (t -> Q Exp) -> (t -> Q (TExp t)) -> Lift t
liftTyped :: ConstraintNameDB -> Q (TExp ConstraintNameDB)
$cliftTyped :: ConstraintNameDB -> Q (TExp ConstraintNameDB)
lift :: ConstraintNameDB -> Q Exp
$clift :: ConstraintNameDB -> Q Exp
Lift)

-- | @since 2.12.0.0
instance DatabaseName ConstraintNameDB where
  escapeWith :: (Text -> str) -> ConstraintNameDB -> str
escapeWith Text -> str
f (ConstraintNameDB Text
n) = Text -> str
f Text
n

-- | An 'ConstraintNameHS' represents the Haskell-side name that @persistent@
-- will use for a constraint.
--
-- @since 2.12.0.0
newtype ConstraintNameHS = ConstraintNameHS { ConstraintNameHS -> Text
unConstraintNameHS :: Text }
  deriving (Int -> ConstraintNameHS -> ShowS
[ConstraintNameHS] -> ShowS
ConstraintNameHS -> String
(Int -> ConstraintNameHS -> ShowS)
-> (ConstraintNameHS -> String)
-> ([ConstraintNameHS] -> ShowS)
-> Show ConstraintNameHS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConstraintNameHS] -> ShowS
$cshowList :: [ConstraintNameHS] -> ShowS
show :: ConstraintNameHS -> String
$cshow :: ConstraintNameHS -> String
showsPrec :: Int -> ConstraintNameHS -> ShowS
$cshowsPrec :: Int -> ConstraintNameHS -> ShowS
Show, ConstraintNameHS -> ConstraintNameHS -> Bool
(ConstraintNameHS -> ConstraintNameHS -> Bool)
-> (ConstraintNameHS -> ConstraintNameHS -> Bool)
-> Eq ConstraintNameHS
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConstraintNameHS -> ConstraintNameHS -> Bool
$c/= :: ConstraintNameHS -> ConstraintNameHS -> Bool
== :: ConstraintNameHS -> ConstraintNameHS -> Bool
$c== :: ConstraintNameHS -> ConstraintNameHS -> Bool
Eq, ReadPrec [ConstraintNameHS]
ReadPrec ConstraintNameHS
Int -> ReadS ConstraintNameHS
ReadS [ConstraintNameHS]
(Int -> ReadS ConstraintNameHS)
-> ReadS [ConstraintNameHS]
-> ReadPrec ConstraintNameHS
-> ReadPrec [ConstraintNameHS]
-> Read ConstraintNameHS
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConstraintNameHS]
$creadListPrec :: ReadPrec [ConstraintNameHS]
readPrec :: ReadPrec ConstraintNameHS
$creadPrec :: ReadPrec ConstraintNameHS
readList :: ReadS [ConstraintNameHS]
$creadList :: ReadS [ConstraintNameHS]
readsPrec :: Int -> ReadS ConstraintNameHS
$creadsPrec :: Int -> ReadS ConstraintNameHS
Read, Eq ConstraintNameHS
Eq ConstraintNameHS
-> (ConstraintNameHS -> ConstraintNameHS -> Ordering)
-> (ConstraintNameHS -> ConstraintNameHS -> Bool)
-> (ConstraintNameHS -> ConstraintNameHS -> Bool)
-> (ConstraintNameHS -> ConstraintNameHS -> Bool)
-> (ConstraintNameHS -> ConstraintNameHS -> Bool)
-> (ConstraintNameHS -> ConstraintNameHS -> ConstraintNameHS)
-> (ConstraintNameHS -> ConstraintNameHS -> ConstraintNameHS)
-> Ord ConstraintNameHS
ConstraintNameHS -> ConstraintNameHS -> Bool
ConstraintNameHS -> ConstraintNameHS -> Ordering
ConstraintNameHS -> ConstraintNameHS -> ConstraintNameHS
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ConstraintNameHS -> ConstraintNameHS -> ConstraintNameHS
$cmin :: ConstraintNameHS -> ConstraintNameHS -> ConstraintNameHS
max :: ConstraintNameHS -> ConstraintNameHS -> ConstraintNameHS
$cmax :: ConstraintNameHS -> ConstraintNameHS -> ConstraintNameHS
>= :: ConstraintNameHS -> ConstraintNameHS -> Bool
$c>= :: ConstraintNameHS -> ConstraintNameHS -> Bool
> :: ConstraintNameHS -> ConstraintNameHS -> Bool
$c> :: ConstraintNameHS -> ConstraintNameHS -> Bool
<= :: ConstraintNameHS -> ConstraintNameHS -> Bool
$c<= :: ConstraintNameHS -> ConstraintNameHS -> Bool
< :: ConstraintNameHS -> ConstraintNameHS -> Bool
$c< :: ConstraintNameHS -> ConstraintNameHS -> Bool
compare :: ConstraintNameHS -> ConstraintNameHS -> Ordering
$ccompare :: ConstraintNameHS -> ConstraintNameHS -> Ordering
$cp1Ord :: Eq ConstraintNameHS
Ord, ConstraintNameHS -> Q Exp
ConstraintNameHS -> Q (TExp ConstraintNameHS)
(ConstraintNameHS -> Q Exp)
-> (ConstraintNameHS -> Q (TExp ConstraintNameHS))
-> Lift ConstraintNameHS
forall t. (t -> Q Exp) -> (t -> Q (TExp t)) -> Lift t
liftTyped :: ConstraintNameHS -> Q (TExp ConstraintNameHS)
$cliftTyped :: ConstraintNameHS -> Q (TExp ConstraintNameHS)
lift :: ConstraintNameHS -> Q Exp
$clift :: ConstraintNameHS -> Q Exp
Lift)