Hoogle Search

Within LTS Haskell 24.32 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. (-=.) :: forall v typ . PersistField typ => EntityField v typ -> typ -> Update v

    hledger-web Hledger.Web.Import

    Assign a field by subtraction (-=).

    Examples

    subtractAge :: MonadIO m => ReaderT SqlBackend m ()
    subtractAge = updateWhere [UserName ==. "SPJ" ] [UserAge -=. 1]
    
    The above query when applied on dataset-1, will produce this:
    +-----+-----+---------+
    |id   |name |age      |
    +-----+-----+---------+
    |1    |SPJ  |40 -> 39 |
    +-----+-----+---------+
    |2    |Simon|41       |
    +-----+-----+---------+
    

  2. (/<-.) :: forall v typ . PersistField typ => EntityField v typ -> [typ] -> Filter v

    hledger-web Hledger.Web.Import

    Check if value is not in given list.

    Examples

    selectSimon :: MonadIO m => ReaderT SqlBackend m [Entity User]
    selectSimon = selectList [UserAge /<-. [40]] []
    
    The above query when applied on dataset-1, will produce this:
    +-----+-----+-----+
    |id   |name |age  |
    +-----+-----+-----+
    |2    |Simon|41   |
    +-----+-----+-----+
    

  3. (/=.) :: forall v typ . PersistField typ => EntityField v typ -> typ -> Update v

    hledger-web Hledger.Web.Import

    Assign a field by division (/=).

    Examples

    divideAge :: MonadIO m => ReaderT SqlBackend m ()
    divideAge = updateWhere [UserName ==. "SPJ" ] [UserAge /=. 2]
    
    The above query when applied on dataset-1, will produce this:
    +-----+-----+---------+
    |id   |name |age      |
    +-----+-----+---------+
    |1    |SPJ  |40 -> 20 |
    +-----+-----+---------+
    |2    |Simon|41       |
    +-----+-----+---------+
    

  4. (<-.) :: forall v typ . PersistField typ => EntityField v typ -> [typ] -> Filter v

    hledger-web Hledger.Web.Import

    Check if value is in given list.

    Examples

    selectUsers :: MonadIO m => ReaderT SqlBackend m [Entity User]
    selectUsers = selectList [UserAge <-. [40, 41]] []
    
    The above query when applied on dataset-1, will produce this:
    +-----+-----+-----+
    |id   |name |age  |
    +-----+-----+-----+
    |1    |SPJ  |40   |
    +-----+-----+-----+
    |2    |Simon|41   |
    +-----+-----+-----+
    
    selectSPJ :: MonadIO m => ReaderT SqlBackend m [Entity User]
    selectSPJ = selectList [UserAge <-. [40]] []
    
    The above query when applied on dataset-1, will produce this:
    +-----+-----+-----+
    |id   |name |age  |
    +-----+-----+-----+
    |1    |SPJ  |40   |
    +-----+-----+-----+
    

  5. (<.) :: forall v typ . PersistField typ => EntityField v typ -> typ -> Filter v

    hledger-web Hledger.Web.Import

    Less-than check.

    Examples

    selectLessAge :: MonadIO m => ReaderT SqlBackend m [Entity User]
    selectLessAge = selectList [UserAge <. 41 ] []
    
    The above query when applied on dataset-1, will produce this:
    +-----+-----+-----+
    |id   |name |age  |
    +-----+-----+-----+
    |1    |SPJ  |40   |
    +-----+-----+-----+
    

  6. (<=.) :: forall v typ . PersistField typ => EntityField v typ -> typ -> Filter v

    hledger-web Hledger.Web.Import

    Less-than or equal check.

    Examples

    selectLessEqualAge :: MonadIO m => ReaderT SqlBackend m [Entity User]
    selectLessEqualAge = selectList [UserAge <=. 40 ] []
    
    The above query when applied on dataset-1, will produce this:
    +-----+-----+-----+
    |id   |name |age  |
    +-----+-----+-----+
    |1    |SPJ  |40   |
    +-----+-----+-----+
    

  7. (=.) :: forall v typ . PersistField typ => EntityField v typ -> typ -> Update v

    hledger-web Hledger.Web.Import

    Assign a field a value.

    Examples

    updateAge :: MonadIO m => ReaderT SqlBackend m ()
    updateAge = updateWhere [UserName ==. "SPJ" ] [UserAge =. 45]
    
    Similar to updateWhere which is shown in the above example you can use other functions present in the module Database.Persist.Class. Note that the first parameter of updateWhere is [Filter val] and second parameter is [Update val]. By comparing this with the type of ==. and =., you can see that they match up in the above usage. The above query when applied on dataset-1, will produce this:
    +-----+-----+--------+
    |id   |name |age     |
    +-----+-----+--------+
    |1    |SPJ  |40 -> 45|
    +-----+-----+--------+
    |2    |Simon|41      |
    +-----+-----+--------+
    

  8. (==.) :: forall v typ . PersistField typ => EntityField v typ -> typ -> Filter v

    hledger-web Hledger.Web.Import

    Check for equality.

    Examples

    selectSPJ :: MonadIO m => ReaderT SqlBackend m [Entity User]
    selectSPJ = selectList [UserName ==. "SPJ" ] []
    
    The above query when applied on dataset-1, will produce this:
    +-----+-----+-----+
    |id   |name |age  |
    +-----+-----+-----+
    |1    |SPJ  |40   |
    +-----+-----+-----+
    

  9. (>.) :: forall v typ . PersistField typ => EntityField v typ -> typ -> Filter v

    hledger-web Hledger.Web.Import

    Greater-than check.

    Examples

    selectGreaterAge :: MonadIO m => ReaderT SqlBackend m [Entity User]
    selectGreaterAge = selectList [UserAge >. 40 ] []
    
    The above query when applied on dataset-1, will produce this:
    +-----+-----+-----+
    |id   |name |age  |
    +-----+-----+-----+
    |2    |Simon|41   |
    +-----+-----+-----+
    

  10. (>=.) :: forall v typ . PersistField typ => EntityField v typ -> typ -> Filter v

    hledger-web Hledger.Web.Import

    Greater-than or equal check.

    Examples

    selectGreaterEqualAge :: MonadIO m => ReaderT SqlBackend m [Entity User]
    selectGreaterEqualAge = selectList [UserAge >=. 41 ] []
    
    The above query when applied on dataset-1, will produce this:
    +-----+-----+-----+
    |id   |name |age  |
    +-----+-----+-----+
    |2    |Simon|41   |
    +-----+-----+-----+
    

Page 146 of many | Previous | Next