data-basic-0.2.0.2: A database library with a focus on ease of use, type safety and useful error messages

Safe HaskellNone
LanguageHaskell2010

Data.Basic

Synopsis

Documentation

data Key Source #

Instances

Eq Key Source # 

Methods

(==) :: Key -> Key -> Bool #

(/=) :: Key -> Key -> Bool #

Num Key Source # 

Methods

(+) :: Key -> Key -> Key #

(-) :: Key -> Key -> Key #

(*) :: Key -> Key -> Key #

negate :: Key -> Key #

abs :: Key -> Key #

signum :: Key -> Key #

fromInteger :: Integer -> Key #

Ord Key Source # 

Methods

compare :: Key -> Key -> Ordering #

(<) :: Key -> Key -> Bool #

(<=) :: Key -> Key -> Bool #

(>) :: Key -> Key -> Bool #

(>=) :: Key -> Key -> Bool #

max :: Key -> Key -> Key #

min :: Key -> Key -> Key #

Read Key Source # 
Show Key Source # 

Methods

showsPrec :: Int -> Key -> ShowS #

show :: Key -> String #

showList :: [Key] -> ShowS #

ToJSON Key Source # 
FromJSON Key Source # 
ToField Key Source # 

Methods

toField :: Key -> Action #

FromField Key Source # 
(~) ExpressionKind k LiteralExp => Num (DbExp k Key) Source # 

Methods

(+) :: DbExp k Key -> DbExp k Key -> DbExp k Key #

(-) :: DbExp k Key -> DbExp k Key -> DbExp k Key #

(*) :: DbExp k Key -> DbExp k Key -> DbExp k Key #

negate :: DbExp k Key -> DbExp k Key #

abs :: DbExp k Key -> DbExp k Key #

signum :: DbExp k Key -> DbExp k Key #

fromInteger :: Integer -> DbExp k Key #

class (KnownSymbol (TableName table), AllSatisfy (TableField table) (TableFields table), AllSatisfy KnownSymbol (TableFields table), AllSatisfy (ValidConstraint table) (TableConstraints table), AllTypesSatisfy (TypeSatisfies ToField) table (TableFields table), OnMaybe (() :: Constraint) PrimaryKeyConstraint (TablePrimaryKey table), FromRow table) => Table table where Source #

Minimal complete definition

newEntity

Associated Types

type TableName table = (name :: Symbol) | name -> table Source #

type TableFields table :: [Symbol] Source #

type TableConstraints table :: [FieldConstraint] Source #

type TablePrimaryKey table :: Maybe Symbol Source #

type TableRequiredFields table :: [MissingField] Source #

Methods

newEntity :: Entity (Fresh (TableRequiredFields table)) table Source #

class (KnownSymbol name, IsDbExp (TableFieldType table name) ~ False) => TableField table name where Source #

Minimal complete definition

tableFieldLens

Associated Types

type TableFieldType table name :: * Source #

Methods

tableFieldLens :: Lens' table (TableFieldType table name) Source #

Instances

TableField User "id" Source # 

Associated Types

type TableFieldType User ("id" :: Symbol) :: * Source #

TableField User "location" Source # 

Associated Types

type TableFieldType User ("location" :: Symbol) :: * Source #

TableField User "name" Source # 

Associated Types

type TableFieldType User ("name" :: Symbol) :: * Source #

TableField Post "author" Source # 

Associated Types

type TableFieldType Post ("author" :: Symbol) :: * Source #

TableField Post "id" Source # 

Associated Types

type TableFieldType Post ("id" :: Symbol) :: * Source #

TableField Post "name" Source # 

Associated Types

type TableFieldType Post ("name" :: Symbol) :: * Source #

class (AllSatisfy (TableField (UniqueTable name)) (UniqueFields name), KnownSymbol name) => UniqueConstraint name Source #

Associated Types

type UniqueTable name :: * Source #

type UniqueFields name :: [Symbol] Source #

type AllRows table res = (Table table, LiftedStatement Unfiltered '[table] res) Source #

newtype Entity entKind a Source #

Constructors

Entity a 

Instances

(TableField t0 name0, SupportedModifyAccess Bool (Not (Elem Symbol name0 (MissingFieldsNames (MissingFields entKind0)))) existingValue0 (TableFieldType t0 name0), (~) * t7 (Identity (Entity (WithFieldSet name0 entKind0) t0)), (~) * t6 t0, (~) EntityKind t5 entKind0, (~) (* -> * -> *) t4 (->), (~) * t3 (TableFieldType t0 name0), (~) (* -> *) t2 ((->) existingValue0), (~) (* -> * -> *) t1 (->), (~) (* -> *) t11 ((->) (proxy0 name0))) => FieldOpticProxy (t11 (t1 (t2 (Identity t3)) (t4 (Entity t5 t6) t7))) Source # 

Methods

fieldOpticProxy :: t11 (t1 (t2 (Identity t3)) (t4 (Entity t5 t6) t7)) Source #

(TableField t0 name0, SupportedModifyAccess Bool (Not (Elem Symbol name0 (MissingFieldsNames (MissingFields entKind0)))) existingValue0 (TableFieldType t0 name0), (~) * t7 t0, (~) EntityKind t6 (WithFieldSet name0 entKind0), (~) (* -> *) t5 Identity, (~) (* -> *) t4 ((->) (Entity entKind0 t0)), (~) * t3 (TableFieldType t0 name0), (~) (* -> *) t2 ((->) existingValue0), (~) (* -> * -> *) t1 (->), (~) (* -> *) t11 ((->) (proxy0 name0))) => FieldOpticProxy (t11 (t1 (t2 (Identity t3)) (t4 (t5 (Entity t6 t7))))) Source # 

Methods

fieldOpticProxy :: t11 (t1 (t2 (Identity t3)) (t4 (t5 (Entity t6 t7)))) Source #

(TableField t0 name0, SupportedModifyAccess Bool (Not (Elem Symbol name0 (MissingFieldsNames (MissingFields entKind0)))) existingValue0 (TableFieldType t0 name0), (~) * t5 (Entity (WithFieldSet name0 entKind0) t0), (~) * t4 t0, (~) EntityKind t3 entKind0, (~) (* -> * -> *) t2 (->), (~) (* -> *) t1 ((->) (existingValue0 -> Identity (TableFieldType t0 name0))), (~) (* -> *) t7 ((->) (proxy0 name0))) => FieldOpticProxy (t7 (t1 (t2 (Entity t3 t4) (Identity t5)))) Source # 

Methods

fieldOpticProxy :: t7 (t1 (t2 (Entity t3 t4) (Identity t5))) Source #

(TableField t0 name0, SupportedModifyAccess Bool (Not (Elem Symbol name0 (MissingFieldsNames (MissingFields entKind0)))) existingValue0 (TableFieldType t0 name0), (~) * t4 t0, (~) EntityKind t3 (WithFieldSet name0 entKind0), (~) (* -> *) t2 ((->) (Entity entKind0 t0)), (~) (* -> *) t1 ((->) (existingValue0 -> Identity (TableFieldType t0 name0))), (~) (* -> *) t7 ((->) (proxy0 name0))) => FieldOpticProxy (t7 (t1 (t2 (Identity (Entity t3 t4))))) Source # 

Methods

fieldOpticProxy :: t7 (t1 (t2 (Identity (Entity t3 t4)))) Source #

(TableField t0 name0, EqualOrError Bool (Not (Elem Symbol name0 (MissingFieldsNames (MissingFields entKind0)))) True ((:<>:) ((:<>:) (Text "Field ") (ShowType Symbol name0)) (Text " is not set")), (~) * t9 (Const * (TableFieldType t0 name0) (Entity entKind0 t0)), (~) * t8 t0, (~) EntityKind t7 entKind0, (~) (* -> * -> *) t6 (->), (~) * t5 (TableFieldType t0 name0), (~) * t4 (TableFieldType t0 name0), (~) (* -> * -> *) t3 (Const *), (~) (* -> *) t2 ((->) (TableFieldType t0 name0)), (~) (* -> * -> *) t1 (->), (~) (* -> *) t11 ((->) (proxy0 name0))) => FieldOpticProxy (t11 (t1 (t2 (t3 t4 t5)) (t6 (Entity t7 t8) t9))) Source # 

Methods

fieldOpticProxy :: t11 (t1 (t2 (t3 t4 t5)) (t6 (Entity t7 t8) t9)) Source #

(TableField t0 name0, EqualOrError Bool (Not (Elem Symbol name0 (MissingFieldsNames (MissingFields entKind0)))) True ((:<>:) ((:<>:) (Text "Field ") (ShowType Symbol name0)) (Text " is not set")), (~) * t7 (Entity entKind0 t0), (~) * t6 (TableFieldType t0 name0), (~) (* -> * -> *) t5 (Const *), (~) * t4 t0, (~) EntityKind t3 entKind0, (~) (* -> * -> *) t2 (->), (~) (* -> *) t1 ((->) (TableFieldType t0 name0 -> Const * (TableFieldType t0 name0) (TableFieldType t0 name0))), (~) (* -> *) t11 ((->) (proxy0 name0))) => FieldOpticProxy (t11 (t1 (t2 (Entity t3 t4) (t5 t6 t7)))) Source # 

Methods

fieldOpticProxy :: t11 (t1 (t2 (Entity t3 t4) (t5 t6 t7))) Source #

(TableField t0 name0, EqualOrError Bool (Not (Elem Symbol name0 (MissingFieldsNames (MissingFields entKind0)))) True ((:<>:) ((:<>:) (Text "Field ") (ShowType Symbol name0)) (Text " is not set")), (~) * t9 t0, (~) EntityKind t8 entKind0, (~) (* -> *) t7 (Const * (TableFieldType t0 name0)), (~) (* -> *) t6 ((->) (Entity entKind0 t0)), (~) * t5 (TableFieldType t0 name0), (~) * t4 (TableFieldType t0 name0), (~) (* -> * -> *) t3 (Const *), (~) (* -> *) t2 ((->) (TableFieldType t0 name0)), (~) (* -> * -> *) t1 (->), (~) (* -> *) t11 ((->) (proxy0 name0))) => FieldOpticProxy (t11 (t1 (t2 (t3 t4 t5)) (t6 (t7 (Entity t8 t9))))) Source # 

Methods

fieldOpticProxy :: t11 (t1 (t2 (t3 t4 t5)) (t6 (t7 (Entity t8 t9)))) Source #

(TableField t0 name0, EqualOrError Bool (Not (Elem Symbol name0 (MissingFieldsNames (MissingFields entKind0)))) True ((:<>:) ((:<>:) (Text "Field ") (ShowType Symbol name0)) (Text " is not set")), (~) * t6 t0, (~) EntityKind t5 entKind0, (~) * t4 (TableFieldType t0 name0), (~) (* -> * -> *) t3 (Const *), (~) (* -> *) t2 ((->) (Entity entKind0 t0)), (~) (* -> *) t1 ((->) (TableFieldType t0 name0 -> Const * (TableFieldType t0 name0) (TableFieldType t0 name0))), (~) (* -> *) t7 ((->) (proxy0 name0))) => FieldOpticProxy (t7 (t1 (t2 (t3 t4 (Entity t5 t6))))) Source # 

Methods

fieldOpticProxy :: t7 (t1 (t2 (t3 t4 (Entity t5 t6)))) Source #

Eq a => Eq (Entity entKind a) Source # 

Methods

(==) :: Entity entKind a -> Entity entKind a -> Bool #

(/=) :: Entity entKind a -> Entity entKind a -> Bool #

Ord a => Ord (Entity entKind a) Source # 

Methods

compare :: Entity entKind a -> Entity entKind a -> Ordering #

(<) :: Entity entKind a -> Entity entKind a -> Bool #

(<=) :: Entity entKind a -> Entity entKind a -> Bool #

(>) :: Entity entKind a -> Entity entKind a -> Bool #

(>=) :: Entity entKind a -> Entity entKind a -> Bool #

max :: Entity entKind a -> Entity entKind a -> Entity entKind a #

min :: Entity entKind a -> Entity entKind a -> Entity entKind a #

Read a => Read (Entity entKind a) Source # 

Methods

readsPrec :: Int -> ReadS (Entity entKind a) #

readList :: ReadS [Entity entKind a] #

readPrec :: ReadPrec (Entity entKind a) #

readListPrec :: ReadPrec [Entity entKind a] #

Show a => Show (Entity entKind a) Source # 

Methods

showsPrec :: Int -> Entity entKind a -> ShowS #

show :: Entity entKind a -> String #

showList :: [Entity entKind a] -> ShowS #

(IsSubset Symbol (SetFields fs a) (SetFields fs a), AllTypesSatisfy JSONableField a (SetFields fs a)) => ToJSON (Entity (Fresh fs) a) Source # 

Methods

toJSON :: Entity (Fresh fs) a -> Value #

toEncoding :: Entity (Fresh fs) a -> Encoding #

toJSONList :: [Entity (Fresh fs) a] -> Value #

toEncodingList :: [Entity (Fresh fs) a] -> Encoding #

(IsSubset Symbol (TableFields a) (TableFields a), AllTypesSatisfy JSONableField a (TableFields a)) => ToJSON (Entity (FromDb Live) a) Source # 
GetEntityFromValue (SetFields miss a) a miss => FromJSON (Entity (Fresh miss) a) Source # 

Methods

parseJSON :: Value -> Parser (Entity (Fresh miss) a) #

parseJSONList :: Value -> Parser [Entity (Fresh miss) a] #

FromRow a => FromRow (Entity l a) Source # 

Methods

fromRow :: RowParser (Entity l a) #

type VirtualTable foreignKeyName res = (ForeignKeyConstraint foreignKeyName, AllFieldsMatch (ForeignKeyToFields foreignKeyName) (ForeignKeyFromFields foreignKeyName) (ForeignKeyTo foreignKeyName) (ForeignKeyFrom foreignKeyName), LiftedStatement Filtered '[ForeignKeyFrom foreignKeyName] res) Source #

virtualTableLens :: forall foreignKeyName c res. VirtualTable foreignKeyName res => Getter' (Entity (FromDb c) (ForeignKeyTo foreignKeyName)) res Source #

type Getter' s a = PolyOptic (Const a) s s a a Source #

class FieldOpticProxy t Source #

Minimal complete definition

fieldOpticProxy

Instances

(TableField t0 name0, EqualOrError Bool (Not (Elem Symbol name0 fields0)) True ((:<>:) ((:<>:) (Text "Cannot update the field ") (ShowType Symbol name0)) (Text " because it's already updated in this expression")), ValueAsDbExp val0 (TableFieldType t0 name0), (~) * t5 (Identity (UpdateExp ((:) Symbol name0 fields0) t0)), (~) * t4 t0, (~) [Symbol] t3 fields0, (~) (* -> * -> *) t2 (->), (~) (* -> *) t1 ((->) (DbExp FieldExp (TableFieldType t0 name0) -> Identity val0)), (~) (* -> *) t7 ((->) (proxy0 name0))) => FieldOpticProxy (t7 (t1 (t2 (UpdateExp t3 t4) t5))) Source # 

Methods

fieldOpticProxy :: t7 (t1 (t2 (UpdateExp t3 t4) t5)) Source #

(ValueAsDbExp val0 (TableFieldType t0 name0), TableField t0 name0, (~) * t7 (Identity (UpdateExp ((:) Symbol name0 ([] Symbol)) t0)), (~) * t6 t0, (~) VarContext t5 Updating, (~) (* -> * -> *) t4 (->), (~) * t3 val0, (~) (* -> *) t2 ((->) (DbExp FieldExp (TableFieldType t0 name0))), (~) (* -> * -> *) t1 (->), (~) (* -> *) t11 ((->) (proxy0 name0))) => FieldOpticProxy (t11 (t1 (t2 (Identity t3)) (t4 (Var t5 t6) t7))) Source # 

Methods

fieldOpticProxy :: t11 (t1 (t2 (Identity t3)) (t4 (Var t5 t6) t7)) Source #

(ValueAsDbExp val0 (TableFieldType t0 name0), TableField t0 name0, (~) * t5 (UpdateExp ((:) Symbol name0 ([] Symbol)) t0), (~) * t4 t0, (~) VarContext t3 Updating, (~) (* -> * -> *) t2 (->), (~) (* -> *) t1 ((->) (DbExp FieldExp (TableFieldType t0 name0) -> Identity val0)), (~) (* -> *) t7 ((->) (proxy0 name0))) => FieldOpticProxy (t7 (t1 (t2 (Var t3 t4) (Identity t5)))) Source # 

Methods

fieldOpticProxy :: t7 (t1 (t2 (Var t3 t4) (Identity t5))) Source #

(ValueAsDbExp val0 (TableFieldType t0 name0), TableField t0 name0, (~) * t7 t0, (~) [Symbol] t6 ((:) Symbol name0 ([] Symbol)), (~) (* -> *) t5 Identity, (~) * t4 t0, (~) VarContext t3 Updating, (~) (* -> * -> *) t2 (->), (~) (* -> *) t1 ((->) (DbExp FieldExp (TableFieldType t0 name0) -> Identity val0)), (~) (* -> *) t11 ((->) (proxy0 name0))) => FieldOpticProxy (t11 (t1 (t2 (Var t3 t4) (t5 (UpdateExp t6 t7))))) Source # 

Methods

fieldOpticProxy :: t11 (t1 (t2 (Var t3 t4) (t5 (UpdateExp t6 t7)))) Source #

(TableField t0 name0, SupportedModifyAccess Bool (Not (Elem Symbol name0 (MissingFieldsNames (MissingFields entKind0)))) existingValue0 (TableFieldType t0 name0), (~) * t7 (Identity (Entity (WithFieldSet name0 entKind0) t0)), (~) * t6 t0, (~) EntityKind t5 entKind0, (~) (* -> * -> *) t4 (->), (~) * t3 (TableFieldType t0 name0), (~) (* -> *) t2 ((->) existingValue0), (~) (* -> * -> *) t1 (->), (~) (* -> *) t11 ((->) (proxy0 name0))) => FieldOpticProxy (t11 (t1 (t2 (Identity t3)) (t4 (Entity t5 t6) t7))) Source # 

Methods

fieldOpticProxy :: t11 (t1 (t2 (Identity t3)) (t4 (Entity t5 t6) t7)) Source #

(TableField t0 name0, SupportedModifyAccess Bool (Not (Elem Symbol name0 (MissingFieldsNames (MissingFields entKind0)))) existingValue0 (TableFieldType t0 name0), (~) * t7 t0, (~) EntityKind t6 (WithFieldSet name0 entKind0), (~) (* -> *) t5 Identity, (~) (* -> *) t4 ((->) (Entity entKind0 t0)), (~) * t3 (TableFieldType t0 name0), (~) (* -> *) t2 ((->) existingValue0), (~) (* -> * -> *) t1 (->), (~) (* -> *) t11 ((->) (proxy0 name0))) => FieldOpticProxy (t11 (t1 (t2 (Identity t3)) (t4 (t5 (Entity t6 t7))))) Source # 

Methods

fieldOpticProxy :: t11 (t1 (t2 (Identity t3)) (t4 (t5 (Entity t6 t7)))) Source #

(TableField t0 name0, SupportedModifyAccess Bool (Not (Elem Symbol name0 (MissingFieldsNames (MissingFields entKind0)))) existingValue0 (TableFieldType t0 name0), (~) * t5 (Entity (WithFieldSet name0 entKind0) t0), (~) * t4 t0, (~) EntityKind t3 entKind0, (~) (* -> * -> *) t2 (->), (~) (* -> *) t1 ((->) (existingValue0 -> Identity (TableFieldType t0 name0))), (~) (* -> *) t7 ((->) (proxy0 name0))) => FieldOpticProxy (t7 (t1 (t2 (Entity t3 t4) (Identity t5)))) Source # 

Methods

fieldOpticProxy :: t7 (t1 (t2 (Entity t3 t4) (Identity t5))) Source #

(TableField t0 name0, SupportedModifyAccess Bool (Not (Elem Symbol name0 (MissingFieldsNames (MissingFields entKind0)))) existingValue0 (TableFieldType t0 name0), (~) * t4 t0, (~) EntityKind t3 (WithFieldSet name0 entKind0), (~) (* -> *) t2 ((->) (Entity entKind0 t0)), (~) (* -> *) t1 ((->) (existingValue0 -> Identity (TableFieldType t0 name0))), (~) (* -> *) t7 ((->) (proxy0 name0))) => FieldOpticProxy (t7 (t1 (t2 (Identity (Entity t3 t4))))) Source # 

Methods

fieldOpticProxy :: t7 (t1 (t2 (Identity (Entity t3 t4)))) Source #

(TableField t0 name0, EqualOrError Bool (Not (Elem Symbol name0 (MissingFieldsNames (MissingFields entKind0)))) True ((:<>:) ((:<>:) (Text "Field ") (ShowType Symbol name0)) (Text " is not set")), (~) * t9 (Const * (TableFieldType t0 name0) (Entity entKind0 t0)), (~) * t8 t0, (~) EntityKind t7 entKind0, (~) (* -> * -> *) t6 (->), (~) * t5 (TableFieldType t0 name0), (~) * t4 (TableFieldType t0 name0), (~) (* -> * -> *) t3 (Const *), (~) (* -> *) t2 ((->) (TableFieldType t0 name0)), (~) (* -> * -> *) t1 (->), (~) (* -> *) t11 ((->) (proxy0 name0))) => FieldOpticProxy (t11 (t1 (t2 (t3 t4 t5)) (t6 (Entity t7 t8) t9))) Source # 

Methods

fieldOpticProxy :: t11 (t1 (t2 (t3 t4 t5)) (t6 (Entity t7 t8) t9)) Source #

(TableField t0 name0, EqualOrError Bool (Not (Elem Symbol name0 (MissingFieldsNames (MissingFields entKind0)))) True ((:<>:) ((:<>:) (Text "Field ") (ShowType Symbol name0)) (Text " is not set")), (~) * t7 (Entity entKind0 t0), (~) * t6 (TableFieldType t0 name0), (~) (* -> * -> *) t5 (Const *), (~) * t4 t0, (~) EntityKind t3 entKind0, (~) (* -> * -> *) t2 (->), (~) (* -> *) t1 ((->) (TableFieldType t0 name0 -> Const * (TableFieldType t0 name0) (TableFieldType t0 name0))), (~) (* -> *) t11 ((->) (proxy0 name0))) => FieldOpticProxy (t11 (t1 (t2 (Entity t3 t4) (t5 t6 t7)))) Source # 

Methods

fieldOpticProxy :: t11 (t1 (t2 (Entity t3 t4) (t5 t6 t7))) Source #

(TableField t0 name0, EqualOrError Bool (Not (Elem Symbol name0 (MissingFieldsNames (MissingFields entKind0)))) True ((:<>:) ((:<>:) (Text "Field ") (ShowType Symbol name0)) (Text " is not set")), (~) * t9 t0, (~) EntityKind t8 entKind0, (~) (* -> *) t7 (Const * (TableFieldType t0 name0)), (~) (* -> *) t6 ((->) (Entity entKind0 t0)), (~) * t5 (TableFieldType t0 name0), (~) * t4 (TableFieldType t0 name0), (~) (* -> * -> *) t3 (Const *), (~) (* -> *) t2 ((->) (TableFieldType t0 name0)), (~) (* -> * -> *) t1 (->), (~) (* -> *) t11 ((->) (proxy0 name0))) => FieldOpticProxy (t11 (t1 (t2 (t3 t4 t5)) (t6 (t7 (Entity t8 t9))))) Source # 

Methods

fieldOpticProxy :: t11 (t1 (t2 (t3 t4 t5)) (t6 (t7 (Entity t8 t9)))) Source #

(TableField t0 name0, EqualOrError Bool (Not (Elem Symbol name0 (MissingFieldsNames (MissingFields entKind0)))) True ((:<>:) ((:<>:) (Text "Field ") (ShowType Symbol name0)) (Text " is not set")), (~) * t6 t0, (~) EntityKind t5 entKind0, (~) * t4 (TableFieldType t0 name0), (~) (* -> * -> *) t3 (Const *), (~) (* -> *) t2 ((->) (Entity entKind0 t0)), (~) (* -> *) t1 ((->) (TableFieldType t0 name0 -> Const * (TableFieldType t0 name0) (TableFieldType t0 name0))), (~) (* -> *) t7 ((->) (proxy0 name0))) => FieldOpticProxy (t7 (t1 (t2 (t3 t4 (Entity t5 t6))))) Source # 

Methods

fieldOpticProxy :: t7 (t1 (t2 (t3 t4 (Entity t5 t6)))) Source #

(TableField t0 name0, (~) * t9 (Const * (DbExp FieldExp (TableFieldType t0 name0)) (Var anyCtx0 t0)), (~) * t8 t0, (~) VarContext t7 anyCtx0, (~) (* -> * -> *) t6 (->), (~) * t5 (DbExp FieldExp (TableFieldType t0 name0)), (~) * t4 (DbExp FieldExp (TableFieldType t0 name0)), (~) (* -> * -> *) t3 (Const *), (~) (* -> *) t2 ((->) (DbExp FieldExp (TableFieldType t0 name0))), (~) (* -> * -> *) t1 (->), (~) (* -> *) t11 ((->) (proxy0 name0))) => FieldOpticProxy (t11 (t1 (t2 (t3 t4 t5)) (t6 (Var t7 t8) t9))) Source # 

Methods

fieldOpticProxy :: t11 (t1 (t2 (t3 t4 t5)) (t6 (Var t7 t8) t9)) Source #

(TableField t0 name0, (~) * t7 (Var anyCtx0 t0), (~) * t6 (DbExp FieldExp (TableFieldType t0 name0)), (~) (* -> * -> *) t5 (Const *), (~) * t4 t0, (~) VarContext t3 anyCtx0, (~) (* -> * -> *) t2 (->), (~) (* -> *) t1 ((->) (DbExp FieldExp (TableFieldType t0 name0) -> Const * (DbExp FieldExp (TableFieldType t0 name0)) (DbExp FieldExp (TableFieldType t0 name0)))), (~) (* -> *) t11 ((->) (proxy0 name0))) => FieldOpticProxy (t11 (t1 (t2 (Var t3 t4) (t5 t6 t7)))) Source # 

Methods

fieldOpticProxy :: t11 (t1 (t2 (Var t3 t4) (t5 t6 t7))) Source #

(TableField t0 name0, (~) * t5 t0, (~) VarContext t4 anyCtx0, (~) (* -> *) t3 (Const * (DbExp FieldExp (TableFieldType t0 name0))), (~) (* -> *) t2 ((->) (Var anyCtx0 t0)), (~) (* -> *) t1 ((->) (DbExp FieldExp (TableFieldType t0 name0) -> Const * (DbExp FieldExp (TableFieldType t0 name0)) (DbExp FieldExp (TableFieldType t0 name0)))), (~) (* -> *) t7 ((->) (proxy0 name0))) => FieldOpticProxy (t7 (t1 (t2 (t3 (Var t4 t5))))) Source # 

Methods

fieldOpticProxy :: t7 (t1 (t2 (t3 (Var t4 t5)))) Source #

fieldOptic :: forall name o. FieldOpticProxy (Proxy name -> o) => o Source #

class ForeignKeyLensProxy t Source #

Minimal complete definition

foreignKeyLensProxy

Instances

((ForeignKeyConstraint fk0, ForeignKeyFieldsMatch fk0 (ForeignKeyFromFields fk0) (ForeignKeyToFields fk0)), (~) * t4 (Entity entKind0 (ForeignKeyFrom fk0) -> Identity (Entity (WithFieldsSet (ForeignKeyFromFields fk0) entKind0) (ForeignKeyFrom fk0))), (~) * t3 (Entity (FromDb c0) (ForeignKeyTo fk0)), (~) (* -> *) t2 ((->) ()), (~) (* -> * -> *) t1 (->), (~) (* -> *) t0 ((->) (proxy0 fk0))) => ForeignKeyLensProxy (t0 (t1 (t2 (Identity t3)) t4)) Source # 

Methods

foreignKeyLensProxy :: t0 (t1 (t2 (Identity t3)) t4) Source #

((ForeignKeyConstraint fk0, ForeignKeyFieldsMatch fk0 (ForeignKeyFromFields fk0) (ForeignKeyToFields fk0)), (~) * t3 (Entity (WithFieldsSet (ForeignKeyFromFields fk0) entKind0) (ForeignKeyFrom fk0)), (~) (* -> *) t2 ((->) (Entity entKind0 (ForeignKeyFrom fk0))), (~) (* -> *) t1 ((->) (() -> Identity (Entity (FromDb c0) (ForeignKeyTo fk0)))), (~) (* -> *) t0 ((->) (proxy0 fk0))) => ForeignKeyLensProxy (t0 (t1 (t2 (Identity t3)))) Source # 

Methods

foreignKeyLensProxy :: t0 (t1 (t2 (Identity t3))) Source #

((ForeignKeyConstraint fk0, MonadEffect Basic m0, Table (ForeignKeyFrom fk0), Table (ForeignKeyTo fk0), ForeignKeyFieldsMatch fk0 (ForeignKeyFromFields fk0) (ForeignKeyToFields fk0)), (~) * t6 (Entity (FromDb Live) (ForeignKeyFrom fk0) -> Const * (m0 (Entity (FromDb Live) (ForeignKeyTo fk0))) (Entity (FromDb Live) (ForeignKeyFrom fk0))), (~) * t5 (m0 (Entity (FromDb Live) (ForeignKeyTo fk0))), (~) * t4 (m0 (Entity (FromDb Live) (ForeignKeyTo fk0))), (~) (* -> * -> *) t3 (Const *), (~) (* -> *) t2 ((->) (m0 (Entity (FromDb Live) (ForeignKeyTo fk0)))), (~) (* -> * -> *) t1 (->), (~) (* -> *) t0 ((->) (proxy0 fk0))) => ForeignKeyLensProxy (t0 (t1 (t2 (t3 t4 t5)) t6)) Source # 

Methods

foreignKeyLensProxy :: t0 (t1 (t2 (t3 t4 t5)) t6) Source #

((ForeignKeyConstraint fk0, MonadEffect Basic m0, Table (ForeignKeyFrom fk0), Table (ForeignKeyTo fk0), ForeignKeyFieldsMatch fk0 (ForeignKeyFromFields fk0) (ForeignKeyToFields fk0)), (~) * t5 (Entity (FromDb Live) (ForeignKeyFrom fk0)), (~) * t4 (m0 (Entity (FromDb Live) (ForeignKeyTo fk0))), (~) (* -> * -> *) t3 (Const *), (~) (* -> *) t2 ((->) (Entity (FromDb Live) (ForeignKeyFrom fk0))), (~) (* -> *) t1 ((->) (m0 (Entity (FromDb Live) (ForeignKeyTo fk0)) -> Const * (m0 (Entity (FromDb Live) (ForeignKeyTo fk0))) (m0 (Entity (FromDb Live) (ForeignKeyTo fk0))))), (~) (* -> *) t0 ((->) (proxy0 fk0))) => ForeignKeyLensProxy (t0 (t1 (t2 (t3 t4 t5)))) Source # 

Methods

foreignKeyLensProxy :: t0 (t1 (t2 (t3 t4 t5))) Source #

foreignKeyLens :: forall name o. ForeignKeyLensProxy (Proxy name -> o) => o Source #

class Monad m => MonadEffect effKind m #

Minimal complete definition

effect

Instances

(MonadEffect method m, MonadTrans t, Monad (t m)) => MonadEffect method (t m) 

Methods

effect :: Effect method method Msg -> t m (Effect method method Res) #

Monad m => MonadEffect effKind (EffectHandler effKind m) 

Methods

effect :: Effect effKind method Msg -> EffectHandler effKind m (Effect effKind method Res) #

TypeError Constraint (UnhandledError a b) => MonadEffect (Signal a b) IO 

Methods

effect :: Effect (Signal a b) method Msg -> IO (Effect (Signal a b) method Res) #

Monad m => MonadEffect (Signal a b) (MaybeT m) 

Methods

effect :: Effect (Signal a b) method Msg -> MaybeT m (Effect (Signal a b) method Res) #

Monad m => MonadEffect (State * s) (StateT s m) 

Methods

effect :: Effect (State * s) method Msg -> StateT s m (Effect (State * s) method Res) #

Monad m => MonadEffect (Signal e b) (ExceptT e m) 

Methods

effect :: Effect (Signal e b) method Msg -> ExceptT e m (Effect (Signal e b) method Res) #

(Show e, Monad m) => MonadEffect (Signal e b) (ExceptT SomeSignal m) 

Methods

effect :: Effect (Signal e b) method Msg -> ExceptT SomeSignal m (Effect (Signal e b) method Res) #

(Monad m, (~) * b c) => MonadEffect (Signal a c) (EffectHandler (Signal a b) m) 

Methods

effect :: Effect (Signal a c) method Msg -> EffectHandler (Signal a b) m (Effect (Signal a c) method Res) #

allRows :: forall tableName table res. (TableName table ~ tableName, AllRows table res) => res Source #

ddelete :: (LiftedStatement Deleted '[table] res, Selection f, Table table) => DbStatement f '[table] -> res Source #

dupdate :: (MonadEffect Basic m, FromRow table, Selection f) => (Var Updating table -> UpdateExp fields table) -> DbStatement f '[table] -> m [Entity (FromDb Live) table] Source #

insert :: (CanInsert entKind table, MonadEffect Basic m, FromRow table) => Entity entKind table -> m (Entity (FromDb Live) table) Source #

dfilter :: (LiftedStatement Filtered tables res, TableSetVars Filtering tables, Selection f) => (Variables Filtering tables -> ConditionExp) -> DbStatement f tables -> res Source #

save :: forall table pk fields c m. (Table table, Just pk ~ TablePrimaryKey table, fields ~ UniqueFields pk, PrimaryKeyMatch fields table, SetAllFields (TableFields table) table, MonadEffect Basic m) => Entity (FromDb c) table -> m (Entity (FromDb Live) table) Source #

djoin :: LiftedStatement Unfiltered (tables1 ++ tables2) res => DbStatement Unfiltered tables1 -> DbStatement Unfiltered tables2 -> res Source #

dsortOn :: (LiftedStatement Sorted tables res, TableSetVars Sorting tables, Sortable ord, Selection f) => (Variables Sorting tables -> ord) -> DbStatement f tables -> res Source #

dfoldMap :: forall tables aggr f res. (Aggregatable aggr, CanAggregate f, TableSetVars Folding tables, LiftedAggregation (InterpretAsGroupMap res) aggr res) => (Variables Folding tables -> aggr) -> DbStatement f tables -> res Source #

dmap :: forall f res a b m ts t. (Dmap' ((a -> b) -> m ts -> DbStatement f '[t]), LiftedMapStatement f t res) => (a -> b) -> m ts -> res Source #

dgroupOn :: (Groupable group, TableSetVars Grouping tables, Selection f) => (Variables Grouping tables -> group) -> DbStatement f tables -> GroupStatement group tables Source #

rawQuery :: forall a r m. (MonadEffect Basic m, FromRow a, ToRow r) => Text -> r -> m [Entity (FromDb Live) a] Source #

(<.) :: ComparableInDbExp a b => a -> b -> ConditionExp infix 4 Source #

(>.) :: ComparableInDbExp a b => a -> b -> ConditionExp infix 4 Source #

(==.) :: ComparableInDbExp a b => a -> b -> ConditionExp infix 4 Source #

(/=.) :: ComparableInDbExp a b => a -> b -> ConditionExp infix 4 Source #

(<=.) :: ComparableInDbExp a b => a -> b -> ConditionExp infix 4 Source #

(>=.) :: ComparableInDbExp a b => a -> b -> ConditionExp infix 4 Source #

data ConditionExp where Source #

Constructors

In :: LiteralCollection collection a => DbExp k a -> collection -> ConditionExp 

newtype Avg a Source #

Constructors

Avg a 

Instances

newtype Count a Source #

Constructors

Count a 

newtype Min a :: * -> * #

Constructors

Min 

Fields

Instances

Monad Min 

Methods

(>>=) :: Min a -> (a -> Min b) -> Min b #

(>>) :: Min a -> Min b -> Min b #

return :: a -> Min a #

fail :: String -> Min a #

Functor Min 

Methods

fmap :: (a -> b) -> Min a -> Min b #

(<$) :: a -> Min b -> Min a #

MonadFix Min 

Methods

mfix :: (a -> Min a) -> Min a #

Applicative Min 

Methods

pure :: a -> Min a #

(<*>) :: Min (a -> b) -> Min a -> Min b #

(*>) :: Min a -> Min b -> Min b #

(<*) :: Min a -> Min b -> Min a #

Foldable Min 

Methods

fold :: Monoid m => Min m -> m #

foldMap :: Monoid m => (a -> m) -> Min a -> m #

foldr :: (a -> b -> b) -> b -> Min a -> b #

foldr' :: (a -> b -> b) -> b -> Min a -> b #

foldl :: (b -> a -> b) -> b -> Min a -> b #

foldl' :: (b -> a -> b) -> b -> Min a -> b #

foldr1 :: (a -> a -> a) -> Min a -> a #

foldl1 :: (a -> a -> a) -> Min a -> a #

toList :: Min a -> [a] #

null :: Min a -> Bool #

length :: Min a -> Int #

elem :: Eq a => a -> Min a -> Bool #

maximum :: Ord a => Min a -> a #

minimum :: Ord a => Min a -> a #

sum :: Num a => Min a -> a #

product :: Num a => Min a -> a #

Traversable Min 

Methods

traverse :: Applicative f => (a -> f b) -> Min a -> f (Min b) #

sequenceA :: Applicative f => Min (f a) -> f (Min a) #

mapM :: Monad m => (a -> m b) -> Min a -> m (Min b) #

sequence :: Monad m => Min (m a) -> m (Min a) #

Generic1 Min 

Associated Types

type Rep1 (Min :: * -> *) :: * -> * #

Methods

from1 :: Min a -> Rep1 Min a #

to1 :: Rep1 Min a -> Min a #

ToJSON1 Min 

Methods

liftToJSON :: (a -> Value) -> ([a] -> Value) -> Min a -> Value #

liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [Min a] -> Value #

liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> Min a -> Encoding #

liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [Min a] -> Encoding #

FromJSON1 Min 

Methods

liftParseJSON :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Min a) #

liftParseJSONList :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Min a] #

Bounded a => Bounded (Min a) 

Methods

minBound :: Min a #

maxBound :: Min a #

Enum a => Enum (Min a) 

Methods

succ :: Min a -> Min a #

pred :: Min a -> Min a #

toEnum :: Int -> Min a #

fromEnum :: Min a -> Int #

enumFrom :: Min a -> [Min a] #

enumFromThen :: Min a -> Min a -> [Min a] #

enumFromTo :: Min a -> Min a -> [Min a] #

enumFromThenTo :: Min a -> Min a -> Min a -> [Min a] #

Eq a => Eq (Min a) 

Methods

(==) :: Min a -> Min a -> Bool #

(/=) :: Min a -> Min a -> Bool #

Data a => Data (Min a) 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Min a -> c (Min a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Min a) #

toConstr :: Min a -> Constr #

dataTypeOf :: Min a -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Min a)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Min a)) #

gmapT :: (forall b. Data b => b -> b) -> Min a -> Min a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Min a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Min a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Min a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Min a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Min a -> m (Min a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Min a -> m (Min a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Min a -> m (Min a) #

Num a => Num (Min a) 

Methods

(+) :: Min a -> Min a -> Min a #

(-) :: Min a -> Min a -> Min a #

(*) :: Min a -> Min a -> Min a #

negate :: Min a -> Min a #

abs :: Min a -> Min a #

signum :: Min a -> Min a #

fromInteger :: Integer -> Min a #

Ord a => Ord (Min a) 

Methods

compare :: Min a -> Min a -> Ordering #

(<) :: Min a -> Min a -> Bool #

(<=) :: Min a -> Min a -> Bool #

(>) :: Min a -> Min a -> Bool #

(>=) :: Min a -> Min a -> Bool #

max :: Min a -> Min a -> Min a #

min :: Min a -> Min a -> Min a #

Read a => Read (Min a) 
Show a => Show (Min a) 

Methods

showsPrec :: Int -> Min a -> ShowS #

show :: Min a -> String #

showList :: [Min a] -> ShowS #

Generic (Min a) 

Associated Types

type Rep (Min a) :: * -> * #

Methods

from :: Min a -> Rep (Min a) x #

to :: Rep (Min a) x -> Min a #

Ord a => Semigroup (Min a) 

Methods

(<>) :: Min a -> Min a -> Min a #

sconcat :: NonEmpty (Min a) -> Min a #

stimes :: Integral b => b -> Min a -> Min a #

(Ord a, Bounded a) => Monoid (Min a) 

Methods

mempty :: Min a #

mappend :: Min a -> Min a -> Min a #

mconcat :: [Min a] -> Min a #

Hashable a => Hashable (Min a) 

Methods

hashWithSalt :: Int -> Min a -> Int #

hash :: Min a -> Int #

ToJSON a => ToJSON (Min a) 

Methods

toJSON :: Min a -> Value #

toEncoding :: Min a -> Encoding #

toJSONList :: [Min a] -> Value #

toEncodingList :: [Min a] -> Encoding #

FromJSON a => FromJSON (Min a) 

Methods

parseJSON :: Value -> Parser (Min a) #

parseJSONList :: Value -> Parser [Min a] #

Wrapped (Min a) 

Associated Types

type Unwrapped (Min a) :: * #

Methods

_Wrapped' :: Iso' (Min a) (Unwrapped (Min a)) #

Ord a => AggregatableBase (Min (DbExp f a)) Source # 

Associated Types

type AggregationBaseResult (Min (DbExp f a)) :: * Source #

(~) * t (Min b) => Rewrapped (Min a) t 
type Rep1 Min 
type Rep1 Min = D1 (MetaData "Min" "Data.Semigroup" "base" True) (C1 (MetaCons "Min" PrefixI True) (S1 (MetaSel (Just Symbol "getMin") NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1))
type Rep (Min a) 
type Rep (Min a) = D1 (MetaData "Min" "Data.Semigroup" "base" True) (C1 (MetaCons "Min" PrefixI True) (S1 (MetaSel (Just Symbol "getMin") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))
type Unwrapped (Min a) 
type Unwrapped (Min a) = a
type AggregationBaseResult (Min (DbExp f a)) Source # 

newtype Max a :: * -> * #

Constructors

Max 

Fields

Instances

Monad Max 

Methods

(>>=) :: Max a -> (a -> Max b) -> Max b #

(>>) :: Max a -> Max b -> Max b #

return :: a -> Max a #

fail :: String -> Max a #

Functor Max 

Methods

fmap :: (a -> b) -> Max a -> Max b #

(<$) :: a -> Max b -> Max a #

MonadFix Max 

Methods

mfix :: (a -> Max a) -> Max a #

Applicative Max 

Methods

pure :: a -> Max a #

(<*>) :: Max (a -> b) -> Max a -> Max b #

(*>) :: Max a -> Max b -> Max b #

(<*) :: Max a -> Max b -> Max a #

Foldable Max 

Methods

fold :: Monoid m => Max m -> m #

foldMap :: Monoid m => (a -> m) -> Max a -> m #

foldr :: (a -> b -> b) -> b -> Max a -> b #

foldr' :: (a -> b -> b) -> b -> Max a -> b #

foldl :: (b -> a -> b) -> b -> Max a -> b #

foldl' :: (b -> a -> b) -> b -> Max a -> b #

foldr1 :: (a -> a -> a) -> Max a -> a #

foldl1 :: (a -> a -> a) -> Max a -> a #

toList :: Max a -> [a] #

null :: Max a -> Bool #

length :: Max a -> Int #

elem :: Eq a => a -> Max a -> Bool #

maximum :: Ord a => Max a -> a #

minimum :: Ord a => Max a -> a #

sum :: Num a => Max a -> a #

product :: Num a => Max a -> a #

Traversable Max 

Methods

traverse :: Applicative f => (a -> f b) -> Max a -> f (Max b) #

sequenceA :: Applicative f => Max (f a) -> f (Max a) #

mapM :: Monad m => (a -> m b) -> Max a -> m (Max b) #

sequence :: Monad m => Max (m a) -> m (Max a) #

Generic1 Max 

Associated Types

type Rep1 (Max :: * -> *) :: * -> * #

Methods

from1 :: Max a -> Rep1 Max a #

to1 :: Rep1 Max a -> Max a #

ToJSON1 Max 

Methods

liftToJSON :: (a -> Value) -> ([a] -> Value) -> Max a -> Value #

liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [Max a] -> Value #

liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> Max a -> Encoding #

liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [Max a] -> Encoding #

FromJSON1 Max 

Methods

liftParseJSON :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Max a) #

liftParseJSONList :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Max a] #

Bounded a => Bounded (Max a) 

Methods

minBound :: Max a #

maxBound :: Max a #

Enum a => Enum (Max a) 

Methods

succ :: Max a -> Max a #

pred :: Max a -> Max a #

toEnum :: Int -> Max a #

fromEnum :: Max a -> Int #

enumFrom :: Max a -> [Max a] #

enumFromThen :: Max a -> Max a -> [Max a] #

enumFromTo :: Max a -> Max a -> [Max a] #

enumFromThenTo :: Max a -> Max a -> Max a -> [Max a] #

Eq a => Eq (Max a) 

Methods

(==) :: Max a -> Max a -> Bool #

(/=) :: Max a -> Max a -> Bool #

Data a => Data (Max a) 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Max a -> c (Max a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Max a) #

toConstr :: Max a -> Constr #

dataTypeOf :: Max a -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Max a)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Max a)) #

gmapT :: (forall b. Data b => b -> b) -> Max a -> Max a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Max a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Max a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Max a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Max a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Max a -> m (Max a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Max a -> m (Max a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Max a -> m (Max a) #

Num a => Num (Max a) 

Methods

(+) :: Max a -> Max a -> Max a #

(-) :: Max a -> Max a -> Max a #

(*) :: Max a -> Max a -> Max a #

negate :: Max a -> Max a #

abs :: Max a -> Max a #

signum :: Max a -> Max a #

fromInteger :: Integer -> Max a #

Ord a => Ord (Max a) 

Methods

compare :: Max a -> Max a -> Ordering #

(<) :: Max a -> Max a -> Bool #

(<=) :: Max a -> Max a -> Bool #

(>) :: Max a -> Max a -> Bool #

(>=) :: Max a -> Max a -> Bool #

max :: Max a -> Max a -> Max a #

min :: Max a -> Max a -> Max a #

Read a => Read (Max a) 
Show a => Show (Max a) 

Methods

showsPrec :: Int -> Max a -> ShowS #

show :: Max a -> String #

showList :: [Max a] -> ShowS #

Generic (Max a) 

Associated Types

type Rep (Max a) :: * -> * #

Methods

from :: Max a -> Rep (Max a) x #

to :: Rep (Max a) x -> Max a #

Ord a => Semigroup (Max a) 

Methods

(<>) :: Max a -> Max a -> Max a #

sconcat :: NonEmpty (Max a) -> Max a #

stimes :: Integral b => b -> Max a -> Max a #

(Ord a, Bounded a) => Monoid (Max a) 

Methods

mempty :: Max a #

mappend :: Max a -> Max a -> Max a #

mconcat :: [Max a] -> Max a #

Hashable a => Hashable (Max a) 

Methods

hashWithSalt :: Int -> Max a -> Int #

hash :: Max a -> Int #

ToJSON a => ToJSON (Max a) 

Methods

toJSON :: Max a -> Value #

toEncoding :: Max a -> Encoding #

toJSONList :: [Max a] -> Value #

toEncodingList :: [Max a] -> Encoding #

FromJSON a => FromJSON (Max a) 

Methods

parseJSON :: Value -> Parser (Max a) #

parseJSONList :: Value -> Parser [Max a] #

Wrapped (Max a) 

Associated Types

type Unwrapped (Max a) :: * #

Methods

_Wrapped' :: Iso' (Max a) (Unwrapped (Max a)) #

Ord a => AggregatableBase (Max (DbExp f a)) Source # 

Associated Types

type AggregationBaseResult (Max (DbExp f a)) :: * Source #

(~) * t (Max b) => Rewrapped (Max a) t 
type Rep1 Max 
type Rep1 Max = D1 (MetaData "Max" "Data.Semigroup" "base" True) (C1 (MetaCons "Max" PrefixI True) (S1 (MetaSel (Just Symbol "getMax") NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1))
type Rep (Max a) 
type Rep (Max a) = D1 (MetaData "Max" "Data.Semigroup" "base" True) (C1 (MetaCons "Max" PrefixI True) (S1 (MetaSel (Just Symbol "getMax") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))
type Unwrapped (Max a) 
type Unwrapped (Max a) = a
type AggregationBaseResult (Max (DbExp f a)) Source # 

newtype Sum a :: * -> * #

Monoid under addition.

Constructors

Sum 

Fields

Instances

Monad Sum 

Methods

(>>=) :: Sum a -> (a -> Sum b) -> Sum b #

(>>) :: Sum a -> Sum b -> Sum b #

return :: a -> Sum a #

fail :: String -> Sum a #

Functor Sum 

Methods

fmap :: (a -> b) -> Sum a -> Sum b #

(<$) :: a -> Sum b -> Sum a #

Applicative Sum 

Methods

pure :: a -> Sum a #

(<*>) :: Sum (a -> b) -> Sum a -> Sum b #

(*>) :: Sum a -> Sum b -> Sum b #

(<*) :: Sum a -> Sum b -> Sum a #

Foldable Sum 

Methods

fold :: Monoid m => Sum m -> m #

foldMap :: Monoid m => (a -> m) -> Sum a -> m #

foldr :: (a -> b -> b) -> b -> Sum a -> b #

foldr' :: (a -> b -> b) -> b -> Sum a -> b #

foldl :: (b -> a -> b) -> b -> Sum a -> b #

foldl' :: (b -> a -> b) -> b -> Sum a -> b #

foldr1 :: (a -> a -> a) -> Sum a -> a #

foldl1 :: (a -> a -> a) -> Sum a -> a #

toList :: Sum a -> [a] #

null :: Sum a -> Bool #

length :: Sum a -> Int #

elem :: Eq a => a -> Sum a -> Bool #

maximum :: Ord a => Sum a -> a #

minimum :: Ord a => Sum a -> a #

sum :: Num a => Sum a -> a #

product :: Num a => Sum a -> a #

Traversable Sum 

Methods

traverse :: Applicative f => (a -> f b) -> Sum a -> f (Sum b) #

sequenceA :: Applicative f => Sum (f a) -> f (Sum a) #

mapM :: Monad m => (a -> m b) -> Sum a -> m (Sum b) #

sequence :: Monad m => Sum (m a) -> m (Sum a) #

Generic1 Sum 

Associated Types

type Rep1 (Sum :: * -> *) :: * -> * #

Methods

from1 :: Sum a -> Rep1 Sum a #

to1 :: Rep1 Sum a -> Sum a #

Representable Sum 

Associated Types

type Rep (Sum :: * -> *) :: * #

Methods

tabulate :: (Rep Sum -> a) -> Sum a #

index :: Sum a -> Rep Sum -> a #

Bounded a => Bounded (Sum a) 

Methods

minBound :: Sum a #

maxBound :: Sum a #

Eq a => Eq (Sum a) 

Methods

(==) :: Sum a -> Sum a -> Bool #

(/=) :: Sum a -> Sum a -> Bool #

Data a => Data (Sum a) 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Sum a -> c (Sum a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Sum a) #

toConstr :: Sum a -> Constr #

dataTypeOf :: Sum a -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Sum a)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Sum a)) #

gmapT :: (forall b. Data b => b -> b) -> Sum a -> Sum a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Sum a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Sum a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Sum a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Sum a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Sum a -> m (Sum a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Sum a -> m (Sum a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Sum a -> m (Sum a) #

Num a => Num (Sum a) 

Methods

(+) :: Sum a -> Sum a -> Sum a #

(-) :: Sum a -> Sum a -> Sum a #

(*) :: Sum a -> Sum a -> Sum a #

negate :: Sum a -> Sum a #

abs :: Sum a -> Sum a #

signum :: Sum a -> Sum a #

fromInteger :: Integer -> Sum a #

Ord a => Ord (Sum a) 

Methods

compare :: Sum a -> Sum a -> Ordering #

(<) :: Sum a -> Sum a -> Bool #

(<=) :: Sum a -> Sum a -> Bool #

(>) :: Sum a -> Sum a -> Bool #

(>=) :: Sum a -> Sum a -> Bool #

max :: Sum a -> Sum a -> Sum a #

min :: Sum a -> Sum a -> Sum a #

Read a => Read (Sum a) 
Show a => Show (Sum a) 

Methods

showsPrec :: Int -> Sum a -> ShowS #

show :: Sum a -> String #

showList :: [Sum a] -> ShowS #

Generic (Sum a) 

Associated Types

type Rep (Sum a) :: * -> * #

Methods

from :: Sum a -> Rep (Sum a) x #

to :: Rep (Sum a) x -> Sum a #

Num a => Semigroup (Sum a) 

Methods

(<>) :: Sum a -> Sum a -> Sum a #

sconcat :: NonEmpty (Sum a) -> Sum a #

stimes :: Integral b => b -> Sum a -> Sum a #

Num a => Monoid (Sum a) 

Methods

mempty :: Sum a #

mappend :: Sum a -> Sum a -> Sum a #

mconcat :: [Sum a] -> Sum a #

Wrapped (Sum a) 

Associated Types

type Unwrapped (Sum a) :: * #

Methods

_Wrapped' :: Iso' (Sum a) (Unwrapped (Sum a)) #

Num a => AggregatableBase (Sum (DbExp f a)) Source # 

Associated Types

type AggregationBaseResult (Sum (DbExp f a)) :: * Source #

(~) * t (Sum b) => Rewrapped (Sum a) t 
type Rep1 Sum 
type Rep1 Sum = D1 (MetaData "Sum" "Data.Monoid" "base" True) (C1 (MetaCons "Sum" PrefixI True) (S1 (MetaSel (Just Symbol "getSum") NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1))
type Rep Sum 
type Rep Sum = ()
type Rep (Sum a) 
type Rep (Sum a) = D1 (MetaData "Sum" "Data.Monoid" "base" True) (C1 (MetaCons "Sum" PrefixI True) (S1 (MetaSel (Just Symbol "getSum") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))
type Unwrapped (Sum a) 
type Unwrapped (Sum a) = a
type AggregationBaseResult (Sum (DbExp f a)) Source # 

handleBasicPsql :: MonadIO m => Connection -> EffectHandler Basic m a -> m a Source #

Handles SQL by querying a PostgreSQL database.

handleBasic :: Functor m => (forall b. FromRow b => SqlRequest b -> m [b]) -> EffectHandler Basic m a -> m a Source #

connectPostgreSQL :: ByteString -> IO Connection #

Attempt to make a connection based on a libpq connection string. See https://www.postgresql.org/docs/9.5/static/libpq-connect.html#LIBPQ-CONNSTRING for more information. Also note that environment variables also affect parameters not provided, parameters provided as the empty string, and a few other things; see https://www.postgresql.org/docs/9.5/static/libpq-envars.html for details. Here is an example with some of the most commonly used parameters:

host='db.somedomain.com' port=5432 ...

This attempts to connect to db.somedomain.com:5432. Omitting the port will normally default to 5432.

On systems that provide unix domain sockets, omitting the host parameter will cause libpq to attempt to connect via unix domain sockets. The default filesystem path to the socket is constructed from the port number and the DEFAULT_PGSOCKET_DIR constant defined in the pg_config_manual.h header file. Connecting via unix sockets tends to use the peer authentication method, which is very secure and does not require a password.

On Windows and other systems without unix domain sockets, omitting the host will default to localhost.

... dbname='postgres' user='postgres' password='secret \' \\ pw'

This attempts to connect to a database named postgres with user postgres and password secret ' \ pw. Backslash characters will have to be double-quoted in literal Haskell strings, of course. Omitting dbname and user will both default to the system username that the client process is running as.

Omitting password will default to an appropriate password found in the pgpass file, or no password at all if a matching line is not found. See https://www.postgresql.org/docs/9.5/static/libpq-pgpass.html for more information regarding this file.

As all parameters are optional and the defaults are sensible, the empty connection string can be useful for development and exploratory use, assuming your system is set up appropriately.

On Unix, such a setup would typically consist of a local postgresql server listening on port 5432, as well as a system user, database user, and database sharing a common name, with permissions granted to the user on the database.

On Windows, in addition you will either need pg_hba.conf to specify the use of the trust authentication method for the connection, which may not be appropriate for multiuser or production machines, or you will need to use a pgpass file with the password or md5 authentication methods.

See https://www.postgresql.org/docs/9.5/static/client-authentication.html for more information regarding the authentication process.

SSL/TLS will typically "just work" if your postgresql server supports or requires it. However, note that libpq is trivially vulnerable to a MITM attack without setting additional SSL connection parameters. In particular, sslmode needs to be set to require, verify-ca, or verify-full in order to perform certificate validation. When sslmode is require, then you will also need to specify a sslrootcert file, otherwise no validation of the server's identity will be performed. Client authentication via certificates is also possible via the sslcert and sslkey parameters. See https://www.postgresql.org/docs/9.5/static/libpq-ssl.html for detailed information regarding libpq and SSL.

mkFromFile :: FilePath -> Q [Dec] Source #

Generates haskell code from an SQL file.

mkFromFiles :: [FilePath] -> Q [Dec] Source #

Generates haskell code from multiple SQL files.

printToFile :: [FilePath] -> FilePath -> Q [Dec] Source #

Allows you to print generated template haskell code to a file

class FromRow a where #

A collection type that can be converted from a sequence of fields. Instances are provided for tuples up to 10 elements and lists of any length.

Note that instances can be defined outside of postgresql-simple, which is often useful. For example, here's an instance for a user-defined pair:

data User = User { name :: String, fileQuota :: Int }

instance FromRow User where
    fromRow = User <$> field <*> field

The number of calls to field must match the number of fields returned in a single row of the query result. Otherwise, a ConversionFailed exception will be thrown.

Note that field evaluates its result to WHNF, so the caveats listed in mysql-simple and very early versions of postgresql-simple no longer apply. Instead, look at the caveats associated with user-defined implementations of fromField.

Methods

fromRow :: RowParser a #

Instances

FromRow User # 
FromRow Post # 
FromField a => FromRow [a] 

Methods

fromRow :: RowParser [a] #

FromField a => FromRow (Maybe [a]) 

Methods

fromRow :: RowParser (Maybe [a]) #

(FromField a, FromField b) => FromRow (Maybe (a, b)) 

Methods

fromRow :: RowParser (Maybe (a, b)) #

(FromField a, FromField b, FromField c) => FromRow (Maybe (a, b, c)) 

Methods

fromRow :: RowParser (Maybe (a, b, c)) #

(FromField a, FromField b, FromField c, FromField d) => FromRow (Maybe (a, b, c, d)) 

Methods

fromRow :: RowParser (Maybe (a, b, c, d)) #

(FromField a, FromField b, FromField c, FromField d, FromField e) => FromRow (Maybe (a, b, c, d, e)) 

Methods

fromRow :: RowParser (Maybe (a, b, c, d, e)) #

(FromField a, FromField b, FromField c, FromField d, FromField e, FromField f) => FromRow (Maybe (a, b, c, d, e, f)) 

Methods

fromRow :: RowParser (Maybe (a, b, c, d, e, f)) #

(FromField a, FromField b, FromField c, FromField d, FromField e, FromField f, FromField g) => FromRow (Maybe (a, b, c, d, e, f, g)) 

Methods

fromRow :: RowParser (Maybe (a, b, c, d, e, f, g)) #

(FromField a, FromField b, FromField c, FromField d, FromField e, FromField f, FromField g, FromField h) => FromRow (Maybe (a, b, c, d, e, f, g, h)) 

Methods

fromRow :: RowParser (Maybe (a, b, c, d, e, f, g, h)) #

(FromField a, FromField b, FromField c, FromField d, FromField e, FromField f, FromField g, FromField h, FromField i) => FromRow (Maybe (a, b, c, d, e, f, g, h, i)) 

Methods

fromRow :: RowParser (Maybe (a, b, c, d, e, f, g, h, i)) #

(FromField a, FromField b, FromField c, FromField d, FromField e, FromField f, FromField g, FromField h, FromField i, FromField j) => FromRow (Maybe (a, b, c, d, e, f, g, h, i, j)) 

Methods

fromRow :: RowParser (Maybe (a, b, c, d, e, f, g, h, i, j)) #

FromField a => FromRow (Maybe (Vector a)) 

Methods

fromRow :: RowParser (Maybe (Vector a)) #

FromField a => FromRow (Maybe (Only a)) 

Methods

fromRow :: RowParser (Maybe (Only a)) #

FromField a => FromRow (Vector a) 

Methods

fromRow :: RowParser (Vector a) #

FromField a => FromRow (Only a) 

Methods

fromRow :: RowParser (Only a) #

(FromField a, FromField b) => FromRow (a, b) 

Methods

fromRow :: RowParser (a, b) #

(FromRow a, FromRow b) => FromRow ((:.) a b) 

Methods

fromRow :: RowParser (a :. b) #

FromRow a => FromRow (Entity l a) # 

Methods

fromRow :: RowParser (Entity l a) #

(FromField a, FromField b, FromField c) => FromRow (a, b, c) 

Methods

fromRow :: RowParser (a, b, c) #

(FromField a, FromField b, FromField c, FromField d) => FromRow (a, b, c, d) 

Methods

fromRow :: RowParser (a, b, c, d) #

(FromField a, FromField b, FromField c, FromField d, FromField e) => FromRow (a, b, c, d, e) 

Methods

fromRow :: RowParser (a, b, c, d, e) #

(FromField a, FromField b, FromField c, FromField d, FromField e, FromField f) => FromRow (a, b, c, d, e, f) 

Methods

fromRow :: RowParser (a, b, c, d, e, f) #

(FromField a, FromField b, FromField c, FromField d, FromField e, FromField f, FromField g) => FromRow (a, b, c, d, e, f, g) 

Methods

fromRow :: RowParser (a, b, c, d, e, f, g) #

(FromField a, FromField b, FromField c, FromField d, FromField e, FromField f, FromField g, FromField h) => FromRow (a, b, c, d, e, f, g, h) 

Methods

fromRow :: RowParser (a, b, c, d, e, f, g, h) #

(FromField a, FromField b, FromField c, FromField d, FromField e, FromField f, FromField g, FromField h, FromField i) => FromRow (a, b, c, d, e, f, g, h, i) 

Methods

fromRow :: RowParser (a, b, c, d, e, f, g, h, i) #

(FromField a, FromField b, FromField c, FromField d, FromField e, FromField f, FromField g, FromField h, FromField i, FromField j) => FromRow (a, b, c, d, e, f, g, h, i, j) 

Methods

fromRow :: RowParser (a, b, c, d, e, f, g, h, i, j) #

data Cached Source #

Constructors

Live 
Cached