Hello all,
I have a question about ORM and Joins. Is that in principle currently possible, through autogenerated restfull controller. Or if necessary with a manual adjustment?
A product category has the following properties (pk_id, name, fk_product_id) and a product has (pk_id, name, description, price). So a product has one product category and a product category has several products.
Would it be possible to resolve this dependency, so that for example in the default I say give me all product categories and once give me all product categories with the dependencies? This should not be limited to "GET" but should also be possible with POST and PUT?
[
{
"pk_id": 1,
"name": "category",
"fk_product_id": 1
}
]
and once with a reference resolution get the following
[
{
}, "pk_id",
}, "name": "category",
"prodcuts": [
{
}, "pk_id": 1,
}, "name": "product",
{ "description": "bla",
{ "price": 123
}
]
}
]
Hello,
where can I find a working example of using execSqlAsync (Postgres) in Drogon?
The short code snippets provided on the official Drogon website do not compile.
Use execSqlAsyncFuture
instead if you want to make inside your function before the callback,
https://github.com/prothegee/DrogonSQL/blob/main/controllers/test.cc#L66
hi, i am currently trying to use a Websocket controller along with a pubsubservice so i paid a close attention to the websocket chat example provided in the repos, but unfortunately it doesn't really cover my usecase. indeed the chat showed as example works in "closed loop" where incoming messages get forwarded back to the other subscribers of the room. what i want to achieve is to use an inmem data container (say a vector) coming from another part of my program and use its content to publish data to subscribers. So my question is what would be the best pattern to achieve this ? What would be the most elegant way for my WebSocketController to obtain the reference of my std::vector and stream its content ? thank you.
you could store the vector in websocket controller.
using RecvMessageCallback = std::function< void(const TcpConnectionPtr &, MsgBuffer *)>
TcpConnectionPtr->getRecvBuffer()
to read and/or write?
Where do I put code for dragon to do some custom automation for the following? :
Example:
Client from website presses a button to read some data from the local PostgreSQL database.
Dragon will listen for requests using websockets.
Then dragon will parse the JSON data that was requested from client.
Dragon needs to know what this parsed JSON data request means.
Parsed JSON data says to fetch some data from local PostgreSQL database.
After dragon fetches data from local PostgreSQL database, dragon needs to send this fetched data to the client using websocket.
The above can be easily done using node.js But how can the above objectives be done using dragon?
Are there any tutorials other than WiKi and docsforge?
I find WiKi and docsforge a bit too advanced and complicated for a beginner to understand.
Thanks