Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert for readonly #20

Open
tomsmalley opened this issue Mar 4, 2017 · 0 comments
Open

Insert for readonly #20

tomsmalley opened this issue Mar 4, 2017 · 0 comments

Comments

@tomsmalley
Copy link
Contributor

tomsmalley commented Mar 4, 2017

Is it possible to provide a RO which will always use the default to build HsI values? I ask because I'd like to make any id columns readonly, such as:

type instance Columns User =
   '[ 'Column "id" RO R UserId UserId
    , 'Column "name" W R PGText Text
    , ...

but then I can't make an insert with just the other fields using mkHsI:

ghci
:t mkHsI User
mkHsI User
  :: Tagged "id" (TypeError ...)
    -> Tagged "name" Text
    ->  ...

I'd like to have

ghci
:t mkHsI User
mkHsI User
  :: Tagged "name" Text
    ->  ...

where the id would always just use WDef automatically.

For now I just leave RO as WD and provide WDef in mkHsI. This functionality would just make things a slight bit tidier.

I may be missing something, I only discovered this library today after reading this fantastic blog post: http://ren.zone/articles/opaleye-sot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant