john-kelly / elm-postgrest

Make PostgREST requests in Elm
109 stars 14 forks source link

Write API #8

Closed john-kelly closed 6 years ago

john-kelly commented 7 years ago

possible API

create : Mutation Create TeamFeedback
create =
    Rest.create Schema.teamFeedback
        |> Rest.insert .text "hello world"
        |> Rest.insert .feedbackType Like
        |> Rest.insert .user 121740

update : Mutation Update TeamFeedback
update =
    Rest.update Schema.teamFeedback
        [ .name >> Rest.set "bob" ]
        [ .name >> Rest.ilike "%john%" ]

delete : Mutation Delete TeamFeedback
delete =
    Rest.delete Schema.teamFeedback
        [ .name >> Rest.ilike "%john%" ]
john-kelly commented 7 years ago

http://package.elm-lang.org/packages/prozacchiwawa/elm-json-codec/1.0.0/JsonCodec

http://diesel.rs/guides/all-about-updates/

Note for later: ChangeSet vs Change + SelectionSet vs Selection Additionally, do we even need a Change type to begin with?

GambolingPangolin commented 6 years ago

I implemented a version of this for a project. Here is a patch to the release 4.1.0 which shows the implementation. I'd be happy to discuss improvements and modifications!

john-kelly commented 6 years ago

I have a bit of work that I'd be happy to share + chat about. Your ideas + work are quite similar (which is reassuring and indicates we're on to something). Specifically, I'd like to hear your thoughts on the PK abstraction -- but more about that later.

I have not put up a branch because the work has mostly been experimental + developed in a private project.

I'll be sure to ping you when I put something up. Additionally -- if you're available to chat in a more direct manner (elm-lang slack) -- I'll be available later tonight after work.

Thanks for your interest + efforts.