beam-core-0.6.0.0: Type-safe, feature-complete SQL query and manipulation interface for Haskell

Safe HaskellNone
LanguageHaskell2010

Database.Beam.Backend.Types

Contents

Synopsis

Documentation

class BeamBackend be Source #

Class for all beam backends

Associated Types

type BackendFromField be :: * -> Constraint Source #

Requirements to marshal a certain type from a database of a particular backend

newtype Auto x Source #

Newtype wrapper for types that may be given default values by the database. Essentially, a wrapper around 'Maybe x'.

When a value of type 'Auto x' is written to a database (via INSERT or UPDATE, for example), backends will translate a Nothing value into an expression that will evaluate to whatever default value the database would choose. This is useful to insert rows with columns that are auto-incrementable or have a DEFAULT value.

When read from the database, the wrapped value will always be a Just value. This isn't currently enforced at the type-level, but may be in future versions of beam.

Constructors

Auto 

Fields

Instances

(BeamBackend be, FromBackendRow be (Maybe x)) => FromBackendRow be (Auto x) Source # 
HasSqlValueSyntax Value (Maybe x) => HasSqlValueSyntax Value (Auto x) Source # 
Eq x => Eq (Auto x) Source # 

Methods

(==) :: Auto x -> Auto x -> Bool #

(/=) :: Auto x -> Auto x -> Bool #

Ord x => Ord (Auto x) Source # 

Methods

compare :: Auto x -> Auto x -> Ordering #

(<) :: Auto x -> Auto x -> Bool #

(<=) :: Auto x -> Auto x -> Bool #

(>) :: Auto x -> Auto x -> Bool #

(>=) :: Auto x -> Auto x -> Bool #

max :: Auto x -> Auto x -> Auto x #

min :: Auto x -> Auto x -> Auto x #

Read x => Read (Auto x) Source # 
Show x => Show (Auto x) Source # 

Methods

showsPrec :: Int -> Auto x -> ShowS #

show :: Auto x -> String #

showList :: [Auto x] -> ShowS #

Generic (Auto x) Source # 

Associated Types

type Rep (Auto x) :: * -> * #

Methods

from :: Auto x -> Rep (Auto x) x #

to :: Rep (Auto x) x -> Auto x #

Monoid x => Monoid (Auto x) Source # 

Methods

mempty :: Auto x #

mappend :: Auto x -> Auto x -> Auto x #

mconcat :: [Auto x] -> Auto x #

ToJSON a => ToJSON (Auto a) Source # 
FromJSON a => FromJSON (Auto a) Source # 
type Rep (Auto x) Source # 
type Rep (Auto x) = D1 * (MetaData "Auto" "Database.Beam.Backend.Types" "beam-core-0.6.0.0-Feilgxv0XmtFKZRFFLjWiE" True) (C1 * (MetaCons "Auto" PrefixI True) (S1 * (MetaSel (Just Symbol "unAuto") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * (Maybe x))))

data FromBackendRowF be f where Source #

Constructors

ParseOneField :: BackendFromField be a => (a -> f) -> FromBackendRowF be f 
PeekField :: BackendFromField be a => (Maybe a -> f) -> FromBackendRowF be f 
CheckNextNNull :: Int -> (Bool -> f) -> FromBackendRowF be f 

Instances

Functor (FromBackendRowF be) Source # 

Methods

fmap :: (a -> b) -> FromBackendRowF be a -> FromBackendRowF be b #

(<$) :: a -> FromBackendRowF be b -> FromBackendRowF be a #

class BeamBackend be => FromBackendRow be a where Source #

Instances

BeamBackend be => FromBackendRow be () Source # 
(BeamBackend be, FromBackendRow be (Maybe x)) => FromBackendRow be (Auto x) Source # 
FromBackendRow be x => FromBackendRow be (Maybe x) Source # 
(BeamBackend be, Generic (tbl (Nullable Identity)), Generic (tbl (Nullable Exposed)), GFromBackendRow be (Rep (tbl (Nullable Exposed))) (Rep (tbl (Nullable Identity)))) => FromBackendRow be (tbl (Nullable Identity)) Source # 
(BeamBackend be, Generic (tbl Identity), Generic (tbl Exposed), GFromBackendRow be (Rep (tbl Exposed)) (Rep (tbl Identity))) => FromBackendRow be (tbl Identity) Source # 
FromBackendRow be x => FromBackendRow be (SqlSerial x) Source # 
(BeamBackend be, FromBackendRow be a, FromBackendRow be b) => FromBackendRow be (a, b) Source # 

Methods

fromBackendRow :: FromBackendRowM be (a, b) Source #

valuesNeeded :: Proxy * be -> Proxy * (a, b) -> Int Source #

(BeamBackend be, KnownNat n, FromBackendRow be a) => FromBackendRow be (Vector n a) Source # 
(BeamBackend be, FromBackendRow be a, FromBackendRow be b, FromBackendRow be c) => FromBackendRow be (a, b, c) Source # 

Methods

fromBackendRow :: FromBackendRowM be (a, b, c) Source #

valuesNeeded :: Proxy * be -> Proxy * (a, b, c) -> Int Source #

(BeamBackend be, FromBackendRow be a, FromBackendRow be b, FromBackendRow be c, FromBackendRow be d) => FromBackendRow be (a, b, c, d) Source # 

Methods

fromBackendRow :: FromBackendRowM be (a, b, c, d) Source #

valuesNeeded :: Proxy * be -> Proxy * (a, b, c, d) -> Int Source #

(BeamBackend be, FromBackendRow be a, FromBackendRow be b, FromBackendRow be c, FromBackendRow be d, FromBackendRow be e) => FromBackendRow be (a, b, c, d, e) Source # 

Methods

fromBackendRow :: FromBackendRowM be (a, b, c, d, e) Source #

valuesNeeded :: Proxy * be -> Proxy * (a, b, c, d, e) -> Int Source #

(BeamBackend be, FromBackendRow be a, FromBackendRow be b, FromBackendRow be c, FromBackendRow be d, FromBackendRow be e, FromBackendRow be f) => FromBackendRow be (a, b, c, d, e, f) Source # 

Methods

fromBackendRow :: FromBackendRowM be (a, b, c, d, e, f) Source #

valuesNeeded :: Proxy * be -> Proxy * (a, b, c, d, e, f) -> Int Source #

(BeamBackend be, FromBackendRow be a, FromBackendRow be b, FromBackendRow be c, FromBackendRow be d, FromBackendRow be e, FromBackendRow be f, FromBackendRow be g) => FromBackendRow be (a, b, c, d, e, f, g) Source # 

Methods

fromBackendRow :: FromBackendRowM be (a, b, c, d, e, f, g) Source #

valuesNeeded :: Proxy * be -> Proxy * (a, b, c, d, e, f, g) -> Int Source #

(BeamBackend be, FromBackendRow be a, FromBackendRow be b, FromBackendRow be c, FromBackendRow be d, FromBackendRow be e, FromBackendRow be f, FromBackendRow be g, FromBackendRow be h) => FromBackendRow be (a, b, c, d, e, f, g, h) Source # 

Methods

fromBackendRow :: FromBackendRowM be (a, b, c, d, e, f, g, h) Source #

valuesNeeded :: Proxy * be -> Proxy * (a, b, c, d, e, f, g, h) -> Int Source #

data Exposed x Source #

newtype mainly used to inspect tho tag structure of a particular Beamable. Prevents overlapping instances in some case. Usually not used in end-user code.

Instances

data Nullable (c :: * -> *) x Source #

Support for NULLable Foreign Key references.

data MyTable f = MyTable
               { nullableRef :: PrimaryKey AnotherTable (Nullable f)
               , ... }
                deriving (Generic, Typeable)

See Columnar for more information.

Instances

(Beamable t, contextPredicate context) => ProjectibleWithPredicate contextPredicate syntax (t (Nullable (QGenExpr context syntax s))) Source # 

Methods

project' :: Monad m => Proxy (* -> Constraint) contextPredicate -> (forall context0. contextPredicate context0 => Proxy * context0 -> WithExprContext syntax -> m (WithExprContext syntax)) -> t (Nullable (QGenExpr context syntax s)) -> m (t (Nullable (QGenExpr context syntax s))) Source #

(BeamBackend be, Generic (tbl (Nullable Identity)), Generic (tbl (Nullable Exposed)), GFromBackendRow be (Rep (tbl (Nullable Exposed))) (Rep (tbl (Nullable Identity)))) => FromBackendRow be (tbl (Nullable Identity)) Source # 
Beamable tbl => ThreadRewritable s (tbl (Nullable (QGenExpr ctxt syntax s))) Source # 

Associated Types

type WithRewrittenThread s s' (tbl (Nullable (QGenExpr ctxt syntax s))) :: * Source #

Methods

rewriteThread :: Proxy * s' -> tbl (Nullable (QGenExpr ctxt syntax s)) -> WithRewrittenThread s s' (tbl (Nullable (QGenExpr ctxt syntax s))) Source #

(IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) Bool, Beamable t) => SqlDeconstructMaybe syntax (t (Nullable (QExpr syntax s))) (t (QExpr syntax s)) s Source # 

Methods

isJust_ :: t (Nullable (QExpr syntax s)) -> QExpr syntax s Bool Source #

isNothing_ :: t (Nullable (QExpr syntax s)) -> QExpr syntax s Bool Source #

maybe_ :: QExpr syntax s y -> (t (QExpr syntax s) -> QExpr syntax s y) -> t (Nullable (QExpr syntax s)) -> QExpr syntax s y Source #

FieldsFulfillConstraintNullable c t => GFieldsFulfillConstraint c (K1 * R (t (Nullable Exposed))) (K1 * R (t (Nullable Identity))) (K1 * R (t (Nullable (WithConstraint c)))) Source # 

Methods

gWithConstrainedFields :: Proxy (* -> Constraint) c -> Proxy (* -> *) (K1 * R (t (Nullable Exposed))) -> K1 * R (t (Nullable Identity)) () -> K1 * R (t (Nullable (WithConstraint c))) () Source #

Beamable tbl => ContextRewritable (tbl (Nullable (QGenExpr old syntax s))) Source # 

Associated Types

type WithRewrittenContext (tbl (Nullable (QGenExpr old syntax s))) ctxt :: * Source #

Methods

rewriteContext :: Proxy * ctxt -> tbl (Nullable (QGenExpr old syntax s)) -> WithRewrittenContext (tbl (Nullable (QGenExpr old syntax s))) ctxt Source #

(Beamable table, IsSql92ExpressionSyntax syntax, FieldsFulfillConstraintNullable (HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax)) table) => SqlValable (table (Nullable (QGenExpr ctxt syntax s))) Source # 

Methods

val_ :: HaskellLiteralForQExpr (table (Nullable (QGenExpr ctxt syntax s))) -> table (Nullable (QGenExpr ctxt syntax s)) Source #

TagReducesTo f f' => TagReducesTo (Nullable f) f' Source # 

Methods

reduceTag :: Functor m => (Columnar' f' a' -> m (Columnar' f' a')) -> Columnar' (Nullable f) a -> m (Columnar' (Nullable f) a) Source #

Table t => SqlJustable (t Identity) (t (Nullable Identity)) Source # 
(Table t, IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) SqlNull) => SqlJustable (t (QExpr syntax s)) (t (Nullable (QExpr syntax s))) Source # 

Methods

just_ :: t (QExpr syntax s) -> t (Nullable (QExpr syntax s)) Source #

nothing_ :: t (Nullable (QExpr syntax s)) Source #

Table t => SqlJustable (PrimaryKey t Identity) (PrimaryKey t (Nullable Identity)) Source # 
(Table t, IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) SqlNull) => SqlJustable (PrimaryKey t (QExpr syntax s)) (PrimaryKey t (Nullable (QExpr syntax s))) Source # 

Methods

just_ :: PrimaryKey t (QExpr syntax s) -> PrimaryKey t (Nullable (QExpr syntax s)) Source #

nothing_ :: PrimaryKey t (Nullable (QExpr syntax s)) Source #

(IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) Bool, Beamable tbl) => SqlEq (QGenExpr context syntax s) (tbl (Nullable (QGenExpr context syntax s))) Source # 

Methods

(==.) :: tbl (Nullable (QGenExpr context syntax s)) -> tbl (Nullable (QGenExpr context syntax s)) -> QGenExpr context syntax s Bool Source #

(/=.) :: tbl (Nullable (QGenExpr context syntax s)) -> tbl (Nullable (QGenExpr context syntax s)) -> QGenExpr context syntax s Bool Source #

type WithRewrittenThread s s' (tbl (Nullable (QGenExpr ctxt syntax s))) Source # 
type WithRewrittenThread s s' (tbl (Nullable (QGenExpr ctxt syntax s))) = tbl (Nullable (QGenExpr ctxt syntax s'))
type QExprToIdentity (table (Nullable c)) Source # 
type QExprToIdentity (table (Nullable c)) = Maybe (QExprToIdentity (table c))
type HaskellLiteralForQExpr (table (Nullable f)) Source # 
type WithRewrittenContext (tbl (Nullable (QGenExpr old syntax s))) ctxt Source # 
type WithRewrittenContext (tbl (Nullable (QGenExpr old syntax s))) ctxt = tbl (Nullable (QGenExpr ctxt syntax s))

Orphan instances

Generic (a, b, c, d, e, f, g, h) Source # 

Associated Types

type Rep (a, b, c, d, e, f, g, h) :: * -> * #

Methods

from :: (a, b, c, d, e, f, g, h) -> Rep (a, b, c, d, e, f, g, h) x #

to :: Rep (a, b, c, d, e, f, g, h) x -> (a, b, c, d, e, f, g, h) #