Giter Site home page Giter Site logo

Review database pool abstraction about kitsune HOT 2 OPEN

aumetra avatar aumetra commented on June 18, 2024
Review database pool abstraction

from kitsune.

Comments (2)

aumetra avatar aumetra commented on June 18, 2024

New API idea:

  1. Rename .with_connection to .pipeline to change the semantics by naming
  2. Implement the required diesel-async traits for the pool which internally just borrow a connection and execute it on the connection (traits being AsyncConnection, SimpleAsyncConnection, and UpdateAndFetchResults)

This would allow pipelining the same way as before:

pool.pipeline(|conn| async move {
       [query]
   }
   .scoped()
).await?;

and would simplify single queries that can't be pipelined:

users::table.find(user_id).load(&mut pool).await?

from kitsune.

aumetra avatar aumetra commented on June 18, 2024

One of the tradeoffs here is one more layer of boxing futures. Since diesel-async uses async-trait for various traits, we would have to box again meaning we poll a boxed future inside a boxed future, missing some inline opportunities.

Won't break the world and we will still be faster by multiple magnitudes than other implementations, just something to keep in mind for now.

from kitsune.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.