Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Table row = Table { }
- empty :: Table row
- fromRows :: [( Int , row)] -> Table row
- fromList :: [row] -> Table row
- toPile :: Table row -> Pile row
- toRows :: Table row -> Pile ( Int , row)
- selectWhere :: (row -> Bool ) -> Table row -> Pile row
- insertMany :: [row] -> Table row -> Table row
- deleteWhere :: (row -> Bool ) -> Table row -> Table row
- updateWhere :: (row -> Bool ) -> (row -> row) -> Table row -> Table row
-
data
DeltaTable
row
- = InsertMany [row]
- | DeleteWhere (row -> Bool )
- | UpdateWhere (row -> Bool ) (row -> row)
-
data
DeltaDB
key row
- = InsertManyDB [(key, row)]
- | DeleteManyDB [key]
- | UpdateManyDB [(key, row)]
- tableIntoDatabase :: Embedding [ DeltaTable row] [ DeltaDB Int row]
-
newtype
Pile
a =
Pile
{
- getPile :: [a]
- fromSet :: Set a -> Pile a
- deltaListToPile :: DeltaList a -> Pile ( Int , a)
- deltaListFromPile :: Pile ( Int , a) -> DeltaList a
- deltaSetToPile :: DeltaSet a -> Pile ( DeltaSet1 a)
- deltaSetFromPile :: Ord a => Pile ( DeltaSet1 a) -> DeltaSet a
- data Supply
- abundance :: Supply
- fresh :: Supply -> ( Int , Supply )
- consume :: [ Int ] -> Supply -> Supply
Synopsis
Table
models a database table.
It corresponds to a collection of rows.
Each row has a unique ID, but this is transparent to the API user.
Pile
models a set of values.
Unlike
Set
, it is represented as a lightweight list.
This is used to highlight that the ordering of rows
in a
Table
is
not
deterministic.
Supply
is a supply of unique IDs.
Table
A
Table
is a collection of rows.
fromRows :: [( Int , row)] -> Table row Source #
Construct a
Table
from a list of rows with unique IDs.
toRows :: Table row -> Pile ( Int , row) Source #
Pile of rows with unique IDs contained in the
Table
.
selectWhere :: (row -> Bool ) -> Table row -> Pile row Source #
List all rows satisfying the predicate.
insertMany :: [row] -> Table row -> Table row Source #
Insert rows into the table.
deleteWhere :: (row -> Bool ) -> Table row -> Table row Source #
Delete all rows satisfying the predicate.
updateWhere :: (row -> Bool ) -> (row -> row) -> Table row -> Table row Source #
Update all rows satisfying the predicate
data DeltaTable row Source #
Delta encoding for changes to a
Table
.
InsertMany [row] | |
DeleteWhere (row -> Bool ) | |
UpdateWhere (row -> Bool ) (row -> row) |
Instances
Show row => Show ( DeltaTable row) Source # | |
Defined in Data.Table |
|
Delta ( DeltaTable row) Source # | |
Defined in Data.Table type Base ( DeltaTable row) Source # apply :: DeltaTable row -> Base ( DeltaTable row) -> Base ( DeltaTable row) Source # |
|
type Base ( DeltaTable row) Source # | |
Defined in Data.Table |
Delta encoding for changes to a database table with unique IDs.
InsertManyDB [(key, row)] | |
DeleteManyDB [key] | |
UpdateManyDB [(key, row)] |
tableIntoDatabase :: Embedding [ DeltaTable row] [ DeltaDB Int row] Source #
Pile
A
Pile
is a set of values.
Unlike
Set
, it is represented as a list, and avoids the
Ord
constraint.
This type is useful for highlighting that a collection of values
has no specific order, even though it is not represented as a
Set
.
deltaSetToPile :: DeltaSet a -> Pile ( DeltaSet1 a) Source #
Randomly permute the objects in a
Pile
. Useful for stress testing.
Every function
f :: Pile A -> B
should satisfy
forall g. f . permute g = f
permute :: RandomGen g => g -> Pile a -> Pile a permute = undefined let (index, g2) = randomR (1,n) g1
Map a
DeltaSet
to a
Pile
of single element insertions and deltions.
Supply
A supply of unique IDs.