<div dir="ltr">Hello Nginx list<div><br></div><div style>I'm using OpenResty with libdrizzle to provide a faster API to query certain things from my db.</div><div style><br></div><div style>My current config is like this:</div>
<div style><br></div><div style><div> location ~* ^/resty/usersTable/userId/([0-9\,]+)$ {</div><div> set_unescape_uri $uid $1;</div><div> drizzle_query 'select id, nickname, age, age_p, city, plz, wio_plz, gender from users where id in ($uid)';</div>
<div> drizzle_pass projectdb;</div><div> rds_json on;</div><div> }</div><div><br></div><div style>So this works fine and it gives me the expected output.</div><div style><br></div><div style>
<div style>
My problem is that if I query many user IDs i'm only getting a flat array of arrays without index key. But to improve the processing speed on the client side, I would like to define that the 'id' field should be the first level index in the returned array. I am trying to show what I mean:</div>
<div style><br></div><div style>Current output: </div><div style><br></div><div style>[</div><div style> {"id":1971,"nickname":"Robby1","age":28,"age_p":42,"city":"Dresden","plz":"","wio_plz":"2,4,5","gender":"m"},</div>
<div style> {"id":1972,"nickname":"Robby2","age":29,"age_p":43,"city":"Dresden2","plz":"","wio_plz":"4,5","gender":"f"},<br>
</div><div style> {"id":1973,"nickname":"Robby3","age":30,"age_p":44,"city":"Dresden3","plz":"","wio_plz":"5","gender":"m"},<br>
</div><div style>]<br></div><div style><br></div><div style>What I want:</div><div style><br></div><div style><div>[</div><div><div> 1971:{"nickname":"Robby1","age":28,"age_p":42,"city":"Dresden","plz":"","wio_plz":"2,4,5","gender":"m"},</div>
<div> 1972:{"nickname":"Robby2","age":29,"age_p":43,"city":"Dresden2","plz":"","wio_plz":"4,5","gender":"f"},<br>
</div><div> 1973:{"nickname":"Robby3","age":30,"age_p":44,"city":"Dresden3","plz":"","wio_plz":"5","gender":"m"},</div>
</div><div>]</div><div><br></div><div style>Is there some way how I can define a first level index key in rds-json? I already checked the `rds_json_root` parameter, but this doesn't seem to be what I'm looking for.</div>
<div style><br></div><div style>Thanks,</div><div style><br></div><div style>Mauro</div></div></div></div></div>