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

Optionally Support SQLite instead of just Postgres #31

Open
brandonros opened this issue Nov 23, 2022 · 2 comments
Open

Optionally Support SQLite instead of just Postgres #31

brandonros opened this issue Nov 23, 2022 · 2 comments

Comments

@brandonros
Copy link

Would it be possible?

@brandonros
Copy link
Author

error: error returned from database: near "SET": syntax error
  --> database/transaction.rs:39:13
   |
39 |             sqlx::query!("SET TRANSACTION ISOLATION LEVEL SERIALIZABLE")
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0432]: unresolved imports `sqlx::PgConnection`, `sqlx::Postgres`
 --> database/transaction.rs:4:24
  |
4 | use sqlx::{Connection, PgConnection, Postgres};
  |                        ^^^^^^^^^^^^  ^^^^^^^^ no `Postgres` in the root
  |                        |
  |                        no `PgConnection` in the root
  |                        help: a similar name exists in the module: `Connection`

error[E0432]: unresolved import `sqlx::postgres`
 --> database/object_id.rs:2:12
  |
2 | use sqlx::{postgres::PgTypeInfo, Database};
  |            ^^^^^^^^ could not find `postgres` in `sqlx`

error[E0432]: unresolved imports `sqlx::postgres`, `sqlx::PgConnection`
 --> database/test.rs:8:12
  |
8 | use sqlx::{postgres::PgConnectOptions, ConnectOptions, Executor, PgConnection};
  |            ^^^^^^^^                                              ^^^^^^^^^^^^
  |            |                                                     |
  |            |                                                     no `PgConnection` in the root
  |            could not find `postgres` in `sqlx`                   help: a similar name exists in the module: `Connection`

error[E0433]: failed to resolve: could not find `postgres` in `sqlx`
  --> database/test.rs:15:21
   |
15 |     pub pool: sqlx::postgres::PgPool,
   |                     ^^^^^^^^ could not find `postgres` in `sqlx`

error[E0433]: failed to resolve: could not find `PgPool` in `sqlx`
   --> database/test.rs:129:22
    |
129 |     let pool = sqlx::PgPool::connect_with(pool_options).await?;
    |                      ^^^^^^ could not find `PgPool` in `sqlx`

error[E0412]: cannot find type `PgPool` in crate `sqlx`
   --> database/pool.rs:6:31
    |
6   | pub type PostgresPool = sqlx::PgPool;
    |                               ^^^^^^ help: a struct with a similar name exists: `Pool`
    |
   ::: /Users/brandonros/.cargo/git/checkouts/sqlx-16b768613d6d0f5a/263ae99/sqlx-core/src/pool/mod.rs:216:1
    |
216 | pub struct Pool<DB: Database>(pub(crate) Arc<SharedPool<DB>>);
    | ----------------------------- similarly named struct `Pool` defined here

error[E0412]: cannot find type `Postgres` in crate `sqlx`
   --> database/object_id.rs:209:44
    |
209 | impl<const PREFIX: usize> sqlx::Type<sqlx::Postgres> for ObjectId<PREFIX> {
    |                                            ^^^^^^^^ not found in `sqlx`

error[E0412]: cannot find type `Postgres` in crate `sqlx`
   --> database/object_id.rs:210:30
    |
210 |     fn type_info() -> <sqlx::Postgres as Database>::TypeInfo {
    |                              ^^^^^^^^ not found in `sqlx`

error[E0412]: cannot find type `Postgres` in crate `sqlx`
   --> database/object_id.rs:216:54
    |
216 | impl<'q, const PREFIX: usize> sqlx::Encode<'q, sqlx::Postgres> for ObjectId<PREFIX> {
    |                                                      ^^^^^^^^ not found in `sqlx`

error[E0412]: cannot find type `Postgres` in crate `sqlx`
   --> database/object_id.rs:219:26
    |
219 |         buf: &mut <sqlx::Postgres as sqlx::database::HasArguments<'q>>::ArgumentBuffer,
    |                          ^^^^^^^^ not found in `sqlx`

error[E0412]: cannot find type `Postgres` in crate `sqlx`
   --> database/object_id.rs:226:54
    |
226 | impl<'r, const PREFIX: usize> sqlx::Decode<'r, sqlx::Postgres> for ObjectId<PREFIX> {
    |                                                      ^^^^^^^^ not found in `sqlx`

error[E0412]: cannot find type `Postgres` in crate `sqlx`
   --> database/object_id.rs:228:23
    |
228 |         value: <sqlx::Postgres as sqlx::database::HasValueRef<'r>>::ValueRef,
    |                       ^^^^^^^^ not found in `sqlx`

warning: unused import: `Connection`
 --> database/transaction.rs:4:12
  |
4 | use sqlx::{Connection, PgConnection, Postgres};
  |            ^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `ConnectOptions`
 --> database/test.rs:8:40
  |
8 | use sqlx::{postgres::PgConnectOptions, ConnectOptions, Executor, PgConnection};
  |                                        ^^^^^^^^^^^^^^

warning: unused import: `Executor`
 --> database/test.rs:8:56
  |
8 | use sqlx::{postgres::PgConnectOptions, ConnectOptions, Executor, PgConnection};

a list of errors when changing postgres feature to sqlite in Cargo.tomls

@dimfeld
Copy link
Owner

dimfeld commented Nov 24, 2022

It would need a fair number of changes as there are a number of things that are either Postgres-specific or would need to be done completely differently for SQLite. Can't say it will never happen, but not in the plans for now.

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

2 participants