Getting the updated record after a Persistent update

Daniel Buckmaster

At the moment, if I try to do this inside a handler:

newPerson <- runDB $ update personId [PersonAge =. 27]

newPerson will have the type (). It seems that update doesn't yield any value, so if I want to get the updated entity, I need to do this:

newPerson <- runDB $ do
    update personId [PersonAge =. 27]
    get personId

Which results in newPerson having type Maybe Person, and some additional code to handle the Nothing case (or using fromJust). Is there a way to bypass the issue? Should there be? To me it makes sense for update to return the updated record, but should it really?

Nikita Volkov

update returns (), use updateGet.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

IndexedDB cursor does not get next record after update on iOS

分類Dev

State is not getting updated in Reactjs

分類Dev

getting "Segmentation fault: 11" from NodeJS after 4.0 update

分類Dev

Getting error after pod update to FBSDK 5.0.0 in x code 10.1

分類Dev

Realtime update for updated activity

分類Dev

Is read after update and then verification of updated data is necessary when dealing with SQLite through PHP or Android?

分類Dev

Getting number of occurrence of record

分類Dev

Insert or update query executed successfully but data are not persistent

分類Dev

MoneyWorks: Programmatically update a record

分類Dev

Getting the record with latest record on join order by date

分類Dev

Updating the record of same table when new record is inserted or updated in oracle

分類Dev

visually duplicating existing record when deleted/updated record

分類Dev

Making condition persistent after limit is reached

分類Dev

nodejs 4.2.6 not getting updated to latest version

分類Dev

React - < Input> value is not getting updated on onChange event

分類Dev

not getting updated state value in react using hooks?

分類Dev

Python SQLAlchemy Update Postgres Record

分類Dev

update updated_at time without changing anything

分類Dev

BigQuery update how to get number of updated rows

分類Dev

React - update <select> when <option> updated

分類Dev

ReactJS state is being updated after an API request

分類Dev

useEffect local state behavior after it get updated

分類Dev

Value is not updated in excel after apply vlookup

分類Dev

cannot restart app in openshift after updated gem

分類Dev

cannot restart app in openshift after updated gem

分類Dev

rails: getting most recent record within a loop

分類Dev

FormattedID is not getting generated for new feature record

分類Dev

hql query for getting record for last 12 hours

分類Dev

How to make less output persistent on the terminal, after quitting less?

Related 関連記事

  1. 1

    IndexedDB cursor does not get next record after update on iOS

  2. 2

    State is not getting updated in Reactjs

  3. 3

    getting "Segmentation fault: 11" from NodeJS after 4.0 update

  4. 4

    Getting error after pod update to FBSDK 5.0.0 in x code 10.1

  5. 5

    Realtime update for updated activity

  6. 6

    Is read after update and then verification of updated data is necessary when dealing with SQLite through PHP or Android?

  7. 7

    Getting number of occurrence of record

  8. 8

    Insert or update query executed successfully but data are not persistent

  9. 9

    MoneyWorks: Programmatically update a record

  10. 10

    Getting the record with latest record on join order by date

  11. 11

    Updating the record of same table when new record is inserted or updated in oracle

  12. 12

    visually duplicating existing record when deleted/updated record

  13. 13

    Making condition persistent after limit is reached

  14. 14

    nodejs 4.2.6 not getting updated to latest version

  15. 15

    React - < Input> value is not getting updated on onChange event

  16. 16

    not getting updated state value in react using hooks?

  17. 17

    Python SQLAlchemy Update Postgres Record

  18. 18

    update updated_at time without changing anything

  19. 19

    BigQuery update how to get number of updated rows

  20. 20

    React - update <select> when <option> updated

  21. 21

    ReactJS state is being updated after an API request

  22. 22

    useEffect local state behavior after it get updated

  23. 23

    Value is not updated in excel after apply vlookup

  24. 24

    cannot restart app in openshift after updated gem

  25. 25

    cannot restart app in openshift after updated gem

  26. 26

    rails: getting most recent record within a loop

  27. 27

    FormattedID is not getting generated for new feature record

  28. 28

    hql query for getting record for last 12 hours

  29. 29

    How to make less output persistent on the terminal, after quitting less?

ホットタグ

アーカイブ