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.
insertMany_ :: forall (m :: Type -> Type) . MonadIO m => Collection -> [Document] -> Action m ()mongoDB Database.MongoDB.Query Same as insertMany except don't return _ids
-
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.
executeMany :: QueryParams q => Connection -> Query -> [q] -> IO Int64mysql-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.
formatMany :: QueryParams q => Connection -> Query -> [q] -> IO ByteStringmysql-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.
-
mysql-simple Database.MySQL.Simple.Param Concatenate a series of rendering actions.
-
optparse-generic Options.Generic No documentation available.
-
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)
- new records to insert if there's no conflicts
- for each conflicting existing row, replace the value of recordField1 with the one present in the conflicting new record
- only replace the existing value if it's different from the one present in the conflicting new record
- only replace the existing value if the new value is non-NULL (i.e. don't replace existing values with NULLs.)
- update recordField4 with an arbitrary new value
- only apply the above updates for conflicting rows that meet this condition
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"
catchany :: IO a -> (SomeException -> IO a) -> IO ashelly Shelly A helper to catch any exception (same as ... catch (e :: SomeException) -> ...).
catchany_sh :: Sh a -> (SomeException -> Sh a) -> Sh ashelly Shelly Catch any exception in the Sh monad.
handleany_sh :: (SomeException -> Sh a) -> Sh a -> Sh ashelly Shelly Handle any exception in the Sh monad.