relational-query-0.11.4.1: Typeful, Modular, Relational, algebraic query engine

Copyright 2017-2018 Kei Hibino BSD3 ex8k.hibino@gmail.com experimental unknown None Haskell2010

Database.Relational.Sequence

Description

This module provides structures about sequence tables.

Synopsis

Documentation

data Sequence s i Source #

Basic record to express sequence-table. actual sequence-table is a table which has only one column of integer type.

seqTable :: Sequence s i -> Table s Source #

actual sequence-table

seqExtract :: Sequence s i -> s -> i Source #

sequence number selector for sequence record

seqKey :: Sequence s i -> Pi s i Source #

sequence number projection for sequence record

seqRelation :: TableDerivable s => Sequence s i -> Relation () s Source #

Infer Relation of sequence table

unsafeSpecifySequence :: TableDerivable s => (s -> i) -> Pi s i -> Sequence s i Source #

Unsafely specify sequence table.

data SeqBinding r s i Source #

Record to express binding between normal-table and sequence-table.

boundTable :: SeqBinding r s i -> Table r Source #

normal-table bound to sequence-table

boundKey :: SeqBinding r s i -> Pi r i Source #

sequence key projection for bound record

boundSequence :: SeqBinding r s i -> Sequence s i Source #

sequence table record

unsafeSpecifyBinding :: (TableDerivable r, SequenceDerivable s i) => Pi r i -> SeqBinding r s i Source #

Unsafely specify binding between normal-table and sequence-table.

primaryBinding :: (TableDerivable r, SequenceDerivable s i, HasConstraintKey Primary r i) => SeqBinding r s i Source #

Derive binding using primary key.

class TableDerivable s => SequenceDerivable s i | s -> i where Source #

Sequence derivation rule

Methods

class (TableDerivable r, SequenceDerivable s i) => Binding r s i | r -> s where Source #

Derivation rule for binding between Table and Sequence

Minimal complete definition

Nothing

fromRelation :: Binding r s i => Relation () r -> Sequence s i Source #

Derive Sequence from corresponding Relation

data Number r i Source #

Sequence number type for record type r

Instances
 Eq i => Eq (Number r i) Source # Instance detailsDefined in Database.Relational.Sequence Methods(==) :: Number r i -> Number r i -> Bool #(/=) :: Number r i -> Number r i -> Bool # Ord i => Ord (Number r i) Source # Instance detailsDefined in Database.Relational.Sequence Methodscompare :: Number r i -> Number r i -> Ordering #(<) :: Number r i -> Number r i -> Bool #(<=) :: Number r i -> Number r i -> Bool #(>) :: Number r i -> Number r i -> Bool #(>=) :: Number r i -> Number r i -> Bool #max :: Number r i -> Number r i -> Number r i #min :: Number r i -> Number r i -> Number r i # Show i => Show (Number r i) Source # Instance detailsDefined in Database.Relational.Sequence MethodsshowsPrec :: Int -> Number r i -> ShowS #show :: Number r i -> String #showList :: [Number r i] -> ShowS #

unsafeSpecifyNumber :: Binding r s i => i -> Number r i Source #

Unsafely specify sequence number.

extractNumber :: Number r i -> i Source #

Get untyped sequence number.

Arguments

 :: (i -> r) sequence number should be passed to proper field of record -> Number r i -> r

Unsafely apply sequence number.

Arguments

 :: Binding r s i => (i -> r) sequence number should be passed to proper field of record -> Number r i -> r

Unsafely apply sequence number. Only safe to build corresponding record type.

Arguments

 :: (PersistableWidth s, Integral i, ShowConstantTermsSQL i) => Config -> i sequence number to set. expect not SQL injectable. -> Sequence s i sequence table -> Update ()

Update statement for sequence table

Arguments

 :: (PersistableWidth s, Integral i, ShowConstantTermsSQL i) => i sequence number to set. expect not SQL injectable. -> Sequence s i sequence table -> Update ()

Update statement for sequence table