Ali Albaali

    Ali Albaali

    1 year ago
    Is there a way to return a
    Flow
    from a query?
    j

    Joost Klitsie

    1 year ago
    flow {
        transaction {
        //...
        }
    }
    I mean you can wrap the query into something that returns a flow
    A query itself is a one-time event that works fine with just using a suspend function
    Ali Albaali

    Ali Albaali

    1 year ago
    I think I phrased it wrong. What I meant is to emit new data whenever the database table gets updated.
    j

    Joost Klitsie

    1 year ago
    That is indeed a very different thing 🙂 I do not think it comes out of the box
    Perhaps you can check how it works on the database you are using, like postgresql has listen/notify
    perhaps someone already made a library (quick google https://github.com/Benjozork/exposed-postgres-extensions ) to help with that
    and then you can wrap the results in a flow or whatever
    Ali Albaali

    Ali Albaali

    1 year ago
    Yeah I thought there was a solution out of the box. Thank you for your help! 😃