Hello! Please tell me there is an application that accepts requests for http and converts it to the corresponding function in postgres. During the post-request in the URL, one numeric parameter is transmitted, the other is transmitted in the request body in the form of json. The question is: postgres accepts json in single quotes, how to implement "wrapping" the request body in single quotes or is it accepted to send json in the request body already in them?
P.S. I tried using the replace functions of the bytes and string packages, tried using append, but it seems to me that this is somehow easier to implement)
here's how to substitute the values
rows, err := db.Query("Select * from test.user_comment_ins($1,$2)", userID, body) where body is the data from the POST request:
curl -d {"txt":"cheers"} -H "Content-Type: application/json" -X POST http://127.0.0.1:8080/api/v1/user/5/comment/ if I send it with single quotes, then everything passes and the result of the POST request is returned:
curl -d '{"txt":"cheers"}' -H "Content-Type: application/json" -X POST http://127.0.0.1:80/api/v1/user/5/comment/ can the point is that initially the second option is the standard for sending json, or do you need to perform any manipulations?