Closed rushmorem closed 1 year ago
Great job @rushmorem 💯
I tried to build the client from your branch but getting cylic
dependency error. Have you run into similar issue? 🤔
cargo check
Updating crates.io index
Updating git repository `https://github.com/rushmorem/surrealdb.rs`
Updating git repository `https://github.com/rushmorem/surrealdb`
error: cyclic package dependency: package `getrandom v0.2.8` depends on itself. Cycle:
package `getrandom v0.2.8`
... which satisfies dependency `getrandom = "^0.2.3"` of package `ahash v0.7.6`
... which satisfies dependency `ahash = "^0.7.0"` of package `hashbrown v0.12.3`
... which satisfies dependency `hashbrown = "^0.12"` of package `indexmap v1.9.2`
... which satisfies dependency `indexmap = "^1.5.2"` of package `serde_json v1.0.89`
... which satisfies dependency `serde_json = "^1.0"` of package `wasm-bindgen v0.2.83`
... which satisfies dependency `wasm-bindgen = "^0.2.83"` of package `js-sys v0.3.60`
... which satisfies dependency `js-sys = "^0.3"` of package `getrandom v0.2.8`
... which satisfies dependency `getrandom = "^0.2"` of package `rand_core v0.6.4`
... which satisfies dependency `rand_core = "^0.6"` of package `crypto-common v0.1.6`
... which satisfies dependency `crypto-common = "^0.1.4"` of package `aead v0.5.1`
The packages
surrealdb = "1.0.0-beta.8"
surrealdb-rs = { git = "https://github.com/rushmorem/surrealdb.rs", branch = "embedded-db" }
Thanks @Oyelowo. I haven't run into this. Can you try
surrealdb = { git = "https://github.com/rushmorem/surrealdb", branch = "suppress-warnings" }
instead of surrealdb = "1.0.0-beta.8"
? Currently this library uses that fork instead of the crates.io package so cargo treats them as different packages since they are from different sources.
Awesome! @rushmorem
Both now work! i.e the main and your fork Thanks for the quick fix! 👍
Awesome! @rushmorem
Both now work! i.e the main and your fork Thanks for the quick fix! +1
I'm glad to hear that but that rebase was just to update the fork against main.
@rushmorem Running into the same issue again 🤔
@rushmorem Running into the same issue again thinking
I'm sorry to hear that @Oyelowo. Are you able to post your Cargo.toml
and Cargo.lock
?
No worries @rushmorem.
I have attached both files. Had to use .txt
to make it work with GitHub.
Thanks! This is not directly introduced by surrealdb.rs
. For example, running the examples included by this PR does not trigger this. It's how the extra dependencies you have are interacting with those from surrealdb.rs
. In your case, in particular, enabling surrealdb/kv-indxdb
by default on WASM is what's triggering this even when you are not targeting WASM. I will sort this out right away.
@Oyelowo This should be fixed now. surrealdb/kv-indxdb
is no longer enabled by default on WASM.
@rushmorem This works now! Thanks for taking care of it 💯
@rushmorem This works now! Thanks for taking care of it 100
Awesome! Glad to hear that.
Hi there!
I tried running your query with an in-memory database, but I'm getting an error. It looks like the query is returning a hashMap instead of a vector. Is this expected behavior? Here is my code for reference:
let users: Vec<User> = db.select("user").await?;
use serde::Deserialize;
use surrealdb_rs::storage::Mem;
use surrealdb_rs::Surreal;
#[derive(Debug, Deserialize)]
#[allow(dead_code)]
struct User {
id: String,
name: String,
company: String,
}
#[tokio::main]
async fn main() -> surrealdb_rs::Result<()> {
tracing_subscriber::fmt::init();
let db = Surreal::connect::<Mem>(()).await?;
db.use_ns("namespace").use_db("database").await?;
#[rustfmt::skip]
let results = db
.query("
CREATE user
SET name = $name,
company = $company
")
.bind("name", "John Doe")
.bind("company", "ACME Corporation")
.await?;
// print the created user:
let user: Option<User> = results.get(0, 0)?;
tracing::info!("{user:?}");
// print all users:
let users: Vec<User> = db.select("user").await?; // The line with the issue
tracing::info!("{users:?}");
Ok(())
}
The error I get is:
Error: Error { kind: Deserialization, message: "invalid type: map, expected a sequence" }
Let me know if you need more information or if there's anything I can do to help. Thanks!
Error { kind: Deserialization, message: "invalid type: map, expected a sequence" }
Fixed. Thank you for the detailed report and for testing this PR.
Error { kind: Deserialization, message: "invalid type: map, expected a sequence" }
Fixed. Thank you for the detailed report and for testing this PR.
@rushmorem Wonderful! Works now! Thanks for taking care of it, you're doing a great job 💯
@rushmorem Wonderful! Works now! Thanks for taking care of it, you're doing a great job 100
Thank you.
Was hoping to use embedded server with surrealdb.rs. Curious if there were any reason for closing it. Are there plans to support this in the near future?
https://github.com/surrealdb/surrealdb/pull/1514 @prabirshrestha Maybe you need
Awesome. That is even better.
What is the motivation?
See https://discord.com/channels/902568124350599239/1014970959461105664/1044110778527141948 and the ensuing discussion.
What does this change do?
It adds support for embedding the server in the client itself. This makes switching between embedded and remote instances easy.
What is your testing strategy?
cargo hack check --feature-powerset --skip indxdb --no-dev-deps
to make sure every combination of features builds fine.indxdb
only works on WASM.Is this related to any issues?
No