Skip to content

Commit

Permalink
Explain that optionalTableField uses DEFAULT when you provide Nothing
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjaguarpaw committed Oct 4, 2024
1 parent 1025ae2 commit 5806b81
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Opaleye/Internal/Table.hs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ requiredTableField :: String -> TableFields (Field_ n a) (Field_ n a)
requiredTableField = lmap Just . optionalTableField

-- | 'optionalTableField' is for fields that you can omit on writes,
-- such as fields which have defaults or which are SERIAL.
-- such as fields which have defaults or which are SERIAL. Setting
-- the write value to @Nothing@ uses SQL @DEFAULT@ in the generated
-- update.
optionalTableField :: String -> TableFields (Maybe (Field_ n a)) (Field_ n a)
optionalTableField columnName = TableFields
(optionalW columnName)
Expand Down

0 comments on commit 5806b81

Please sign in to comment.