| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Opaleye.Distinct
Contents
Synopsis
- distinct :: Default Distinctspec fields fields => Select fields -> Select fields
- distinctOnCorrect :: Default Unpackspec b b => (a -> b) -> Select a -> Select a
- distinctOnByCorrect :: Default Unpackspec b b => (a -> b) -> Order a -> Select a -> Select a
- data Distinctspec a b
- distinctExplicit :: Distinctspec fields fields' -> Select fields -> Select fields'
- distinctspecField :: Distinctspec (Column a) (Column a)
- distinctspecMaybeFields :: WithNulls Distinctspec a b -> Distinctspec (MaybeFields a) (MaybeFields b)
Documentation
distinct :: Default Distinctspec fields fields => Select fields -> Select fields Source #
Remove duplicate rows from the Select.
Example type specialization:
distinct :: Select (Field a, Field b) -> Select (Field a, Field b)
Assuming the makeAdaptorAndInstance splice has been run for the product type Foo:
distinct :: Select (Foo (Field a) (Field b) (Field c)) -> Select (Foo (Field a) (Field b) (Field c))
If you want to run distinct on SelectArrs you should
apply laterally to it:
laterallydistinct::DefaultDistinctspecfields fields =>SelectArri fields ->SelectArri fields
distinctOnCorrect :: Default Unpackspec b b => (a -> b) -> Select a -> Select a Source #
Keep a row from each set where the given function returns the same result. No
ordering is guaranteed. Multiple fields may be distinguished by projecting out
tuples of Field_s. Use distinctOnBy to control how the rows
are chosen.
distinctOnByCorrect :: Default Unpackspec b b => (a -> b) -> Order a -> Select a -> Select a Source #
Keep the row from each set where the given function returns the same result. The
row is chosen according to which comes first by the supplied ordering. However, no
output ordering is guaranteed. Mutliple fields may be distinguished by projecting
out tuples of Field_s.
data Distinctspec a b Source #
Instances
Explicit versions
distinctExplicit :: Distinctspec fields fields' -> Select fields -> Select fields' Source #
Adaptors
distinctspecField :: Distinctspec (Column a) (Column a) Source #
distinctspecMaybeFields :: WithNulls Distinctspec a b -> Distinctspec (MaybeFields a) (MaybeFields b) Source #