Implement custom driver in rocket_db_pools #2544
-
Hello. As a PoC i would like to create a driver for a Oracle DB Free using [rocket_db_pools]. I've read the documentation several times and i can't find a way to make it work properly. I'm not asking for specific code or implementation, if you please point me in the right direction to understand how to start as if it were a general driver , would really appreciate that. I've tried deriving directly from trait rocket_db_pools::Database just to see if i could understand the errors and fix them, evidently, i failed miserably. Could you please point me into the right:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Have you taken a close look at the implementing part of the docs? It should be sufficient to guide you to a working implementation. Once you implement Here are some more guidelines:
This all looks like: impl Pool for OraclePool { ... }
#[database("oracle")]
struct MyDb(OraclePool);
#[get("/")]
fn index(db: Connection<MyDb>) {
use_connection(&*db);
} |
Beta Was this translation helpful? Give feedback.
Have you taken a close look at the implementing part of the docs? It should be sufficient to guide you to a working implementation. Once you implement
Pool
for some type, you can use it as the target of thedatabase
attribute.Here are some more guidelines:
rocket_db_pools
exists to integrate existingasync
pools with Rocket applications. As such, you'll need an existingasync
database pool for your database of choice. In your case, this means you need to find or write anasync
connection pool for Oracle. If the pool isn'tasync
(and insteadsync
chronous), you'll need to userocket_sync_db_pools
instead.Pool
for the pool type. If you're using a pool from another crate, you…