fostgres icon indicating copy to clipboard operation
fostgres copied to clipboard

PUT multiple CSJ in one time for serialisation

Open tleekkul opened this issue 8 years ago • 1 comments

I would like to be able to PUT multiple CSJ in one time, separate by blank line to make sure that all of data that I want to PUT is consistent

Example PUT /pokemons/Pikachu HTTP/1.1 Content-Type: application/csj Payload:

"skill","damage"
"Static",30
"Lighting Rod",120

"skill","vs","effectiveness"
"Static","Fire",1.0
"Static","Plant",0.5
"Static","Water",2.0
"Static","Dark",1.0

Expected result

[{
  "deleted": 1,
  "records": 2,
  "selected": 3
},{
  "deleted": 15,
  "records": 4,
  "selected": 4
}]

Suggest Configuration

{
  "path":["/pokemons",1],
  "PUT":[{
    "table":"skills",
    "existing":"SELECT name,skill FROM skills WHERE name=$1",
    "delete":"DELETE FROM skills WHERE name=$1 AND skill=$2",
    "columns":{
      "name":{"key":true, "source": 1},
      "skill":{"key":true},
      "damage":{}
    }
  },{
    "table":"effectiveness",
    "existing":"SELECT name,skill,vs FROM effectiveness WHERE name=$1",
    "delete":"DELETE FROM effectiveness WHERE name=$1 AND skill=$2 AND vs=$3",
    "columns":{
      "name":{"key":true, "source": 1},
      "skill":{"key":true},
      "vs":{"key":true},
      "effectiveness":{}
    }
  }]
}

tleekkul avatar Jun 01 '17 08:06 tleekkul

I think that diff describes the feature that you want. It also includes multiple SELECTs in the GET which will be needed to round trip this.

KayEss avatar Jun 03 '17 03:06 KayEss