Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use file_store library with newer sqlx version #614

Open
kurotych opened this issue Aug 23, 2023 · 0 comments
Open

Use file_store library with newer sqlx version #614

kurotych opened this issue Aug 23, 2023 · 0 comments
Assignees

Comments

@kurotych
Copy link
Member

kurotych commented Aug 23, 2023

Hello. I've tried to use the file_store as a library in my project but faced with next Issue:
The file_store requires a specific sqlx version (0.6.3).

Is there a chance of using the latest sqlx version 0.7.1 with the file_store library?

STR

Cargo.toml

[package]
name = "rust_play"
version = "0.1.0"
edition = "2021"


[dependencies]
file-store = {git = "https://github.com/helium/oracles", branch = "main"}
sqlx = "0.7.1"
tokio = "1.29.0"

main.rs

use sqlx::{
    postgres::{PgConnectOptions, PgPoolOptions},
};
use std::str::FromStr;
use file_store::heartbeat::CellHeartbeatIngestReport;

#[tokio::main]
async fn main() {
    let connection_options =
        PgConnectOptions::from_str("postgres://cas:cas@localhost:5433/cas").expect("Failed to construct connection options");
    let pool = PgPoolOptions::new()
        .max_connections(1)
        .connect_with(connection_options)
        .await
        .expect("DB connection error.");

    file_store::file_source::continuous_source::<CellHeartbeatIngestReport>().db(pool.clone());
}

Error

error[E0308]: mismatched types
   --> src/main.rs:17:82
    |
17  |     file_store::file_source::continuous_source::<CellHeartbeatIngestReport>().db(pool.clone());
    |                                                                               -- ^^^^^^^^^^^^ expected `Pool<Postgres>`, found a different `Pool<Postgres>`
    |                                                                               |
    |                                                                               arguments to this method are incorrect
    |
    = note: `Pool<Postgres>` and `Pool<Postgres>` have similar names, but are actually distinct types
note: `Pool<Postgres>` is defined in crate `sqlx_core`
   --> /home/kurotych/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sqlx-core-0.7.1/src/pool/mod.rs:267:1
    |
267 | pub struct Pool<DB: Database>(pub(crate) Arc<PoolInner<DB>>);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: `Pool<Postgres>` is defined in crate `sqlx_core`
   --> /home/kurotych/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sqlx-core-0.6.3/src/pool/mod.rs:244:1
    |
244 | pub struct Pool<DB: Database>(pub(crate) Arc<PoolInner<DB>>);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `sqlx_core` are being used?
note: method defined here
   --> /home/kurotych/.cargo/git/checkouts/oracles-717ca87c3f481083/3a3552a/file_store/src/file_info_poller.rs:47:5
    |
47  |     db: sqlx::Pool<sqlx::Postgres>,
    |     ^^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `rust_play` (bin "rust_play") due to previous error

As you can see file_store forces me to use sqlx-core-0.6.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants