Hoogle Search

Within LTS Haskell 24.40 (ghc-9.10.3)

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

  1. insertMany_ :: forall (m :: Type -> Type) . MonadIO m => Collection -> [Document] -> Action m ()

    mongoDB Database.MongoDB.Query

    Same as insertMany except don't return _ids

  2. updateMany :: forall (m :: Type -> Type) . MonadIO m => Collection -> [(Selector, Document, [UpdateOption])] -> Action m WriteResult

    mongoDB Database.MongoDB.Query

    Bulk update operation. If one update fails it will not update the remaining documents. Current returned value is only a place holder. With mongodb server before 2.6 it will send update requests one by one. In order to receive error messages in versions under 2.6 you need to user confirmed writes. Otherwise even if the errors had place the list of errors will be empty and the result will be success. After 2.6 it will use bulk update feature in mongodb.

  3. executeMany :: QueryParams q => Connection -> Query -> [q] -> IO Int64

    mysql-simple Database.MySQL.Simple

    Execute a multi-row INSERT, UPDATE, or other SQL query that is not expected to return results. Returns the number of rows affected. Throws FormatError if the query could not be formatted correctly.

  4. formatMany :: QueryParams q => Connection -> Query -> [q] -> IO ByteString

    mysql-simple Database.MySQL.Simple

    Format a query string with a variable number of rows. This function is exposed to help with debugging and logging. Do not use it to prepare queries for execution. The query string must contain exactly one substitution group, identified by the SQL keyword "VALUES" (case insensitive) followed by an "(" character, a series of one or more "?" characters separated by commas, and a ")" character. White space in a substitution group is permitted. Throws FormatError if the query string could not be formatted correctly.

  5. Many :: [Action] -> Action

    mysql-simple Database.MySQL.Simple.Param

    Concatenate a series of rendering actions.

  6. getAny :: Any -> Bool

    optparse-generic Options.Generic

    No documentation available.

  7. upsertManyWhere :: forall record backend (m :: Type -> Type) . (backend ~ PersistEntityBackend record, BackendCompatible SqlBackend backend, PersistEntityBackend record ~ SqlBackend, PersistEntity record, OnlyOneUniqueKey record, MonadIO m) => [record] -> [HandleUpdateCollision record] -> [Update record] -> [Filter record] -> ReaderT backend m ()

    persistent-postgresql Database.Persist.Postgresql

    Postgres specific upsertManyWhere. The first argument is a list of new records to insert. If there's unique key collisions for some or all of the proposed insertions, you can use the second argument to specify which fields, under which conditions (using HandleUpdateCollision strategies,) will be copied from each proposed, conflicting new record onto its corresponding row already present in the database. Helpers such as copyField, copyUnlessEq, copyUnlessNull and copyUnlessEmpty are exported from this module to help with this, as well as the constructors for HandleUpdateCollision. For example, you may have a patch of updates to apply, some of which are NULL to represent "no change"; you'd use copyUnlessNull for each applicable field in this case so any new values in the patch which are NULL don't accidentally overwrite existing values in the database which are non-NULL. Further updates to the matching records already in the database can be specified in the third argument, these are arbitrary updates independent of the new records proposed for insertion. For example, you can use this to update a timestamp or a counter for all conflicting rows. You can use the fourth argument to provide arbitrary conditions to constrain the above updates. This way, you can choose to only alter a subset of the conflicting existing rows while leaving the others alone. For example, you may want to copy fields from new records and update a timestamp only when the corresponding existing row hasn't been soft-deleted. For example,

    upsertManyWhere
    [record]                         -- (1)
    [ copyField recordField1         -- (2)
    , copyUnlessEq recordField2      -- (3)
    , copyUnlessNull recordField3    -- (4)
    ]
    [recordField4 =. arbitraryValue] -- (5)
    [recordField4 !=. anotherValue]  -- (6)
    
    1. new records to insert if there's no conflicts
    2. for each conflicting existing row, replace the value of recordField1 with the one present in the conflicting new record
    3. only replace the existing value if it's different from the one present in the conflicting new record
    4. only replace the existing value if the new value is non-NULL (i.e. don't replace existing values with NULLs.)
    5. update recordField4 with an arbitrary new value
    6. only apply the above updates for conflicting rows that meet this condition
    Called thusly, this method will insert a new record (if none exists) OR it will copy three fields (recordField1, recordField2, recordField3) from the record proposed from insertion onto the existing row in the database following three different HandleUpdateCollision strategies, it will also update recordField4 with an arbitrary arbitraryValue. Both sets of updates will only be applied if the row already present in the database has a recordField4 whose value is not arbitraryValue. The corresponding SQL might look like this:
    INSERT INTO table(recordField1, recordField2, recordField3, recordField4, recordField5)
    VALUES
    (newValue1, newValue2, newValue3, newValue4, newValue5)
    ON CONFLICT (recordField2, recordField3) -- let's imagine these two columns define a unique constraint
    DO UPDATE
    SET
    recordField1 = EXCLUDED.newValue1, -- EXCLUDED points to the new, conflicting, record; so we're always replacing the old value.
    recordField2 = COALESCE(NULLIF(EXCLUDED.newValue2, table.recordField2), table.recordField2), -- if the values are the same, the NULLIF returns NULL and we coalesce into setting the column to the value it already had (i.e. no change)
    recordField3 = COALESCE(NULLIF(EXCLUDED.newValue3, NULL), table.recordField3), -- if the new value is not null, it will be set; if it's null, we coalesce into not changing the existing value.
    recordField4 = arbitraryValue -- an arbitrary update independent of what's in the EXCLUDED (new) record
    WHERE
    recordField4 <> anotherValue -- only do the above updates if the value for the existing row's recordField4 is not "anotherValue"
    

  8. catchany :: IO a -> (SomeException -> IO a) -> IO a

    shelly Shelly

    A helper to catch any exception (same as ... catch (e :: SomeException) -> ...).

  9. catchany_sh :: Sh a -> (SomeException -> Sh a) -> Sh a

    shelly Shelly

    Catch any exception in the Sh monad.

  10. handleany_sh :: (SomeException -> Sh a) -> Sh a -> Sh a

    shelly Shelly

    Handle any exception in the Sh monad.

Page 171 of many | Previous | Next