The Rust client library is now part of the
surrealdb
crate and will be available from version1.0.0-beta.9
.
The official SurrealDB library for Rust.
SurrealDB driver for Rust
Home Page: https://surrealdb.com
License: Apache License 2.0
The Rust client library is now part of the
surrealdb
crate and will be available from version1.0.0-beta.9
.
The official SurrealDB library for Rust.
When my code reaches the signin
function it freezes, no response is returned.
Run searreal DB with the following command
surreal start --log debug --user root --pass root memory
Write the following code in main.rs
use surrealdb_rs::param::Root;
use surrealdb_rs::protocol::Ws;
use surrealdb_rs::{Result, Surreal};
#[tokio::main]
async fn main() -> Result<()> {
println!("sneaky");
let client = Surreal::connect::<Ws>("localhost:8000").await?;
println!("going dark");
client
.signin(Root {
username: "root",
password: "root",
})
.await?;
println!("finish signing in");
// Select a specific namespace and database
client.use_ns("test").use_db("test").await?;
println!("sat DB");
Ok(())
}
The output from the surrealdb CLI is:
[2023-01-04 19:35:51] INFO surreal::web 127.0.0.1:59640 GET /rpc HTTP/1.1 101 "-" 679.6µs
The output from cargo run
is:
Compiling users_micservice v0.1.0 (F:\Programming\Rust\users_micservice)
Finished dev [unoptimized + debuginfo] target(s) in 3.11s
Running `target\debug\users_micservice.exe`
sneaky
going dark
If I forcibly stopped the CLI server using ctrl+c
than the cargo run is also stop
Error: Error { kind: Socket, message: "socket error; receiving on a closed channel" }
error: process didn't exit successfully: `target\debug\users_micservice.exe` (exit code: 1)
My Cargo.toml
[package]
name = "users_micservice"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio = { version = "1", features = ["full"] }
serde = "1.0.152"
serde_json = "1.0.91"
surrealdb-rs = { git = 'https://github.com/surrealdb/surrealdb.rs' }
to login normally
surreal 1.0.0-beta.8+20220930.c246533 for windows on x86_64
in my code, I have some sql example f->t->w
.
I want to get relation id or data.
Relation {
id: thing("identity:1").unwrap(),
from: thing("mobile:1").unwrap(),
with: thing("account:1").unwrap(),
}
let create_identity = format!("relate mobile:123->identity->account:hz content {time: 1234}");
db.execute_one::<Relation>(create_identity).await;
by the way, prop
in
can't be in schema(struct)
What do you think of this feature
execute sql, get relation and data.
none
1.0.0-beta.8
No response
Surrealdb dependency is mapped to git repository https://github.com/rushmorem/surrealdb
, instead to the official crates package registry.
Add this crate dependency to a rust project by running:
cargo add surrealdb-rs --git https://github.com/surrealdb/surrealdb.rs
In this Cargo.toml file the dependency should be mapped to crates package registry.
This version
No response
After playing around with Surrealdb i started getting a couple of questions on why some things are done the way they are.
sql::Value
being used for responses instead of a genericSuggestions
sql::Value
Response::output
not return a reference of the errorAccessing a local file based surrealdb (kv-rocksdb
) is raw with the surrealdb crate.
Connect to the file based database through this SDK.
Implement model controllers from scratch with surrealdb
crate and its Datastore#execute
.
surreal 1.0.0-beta.8+20220930.c246533 for macos on aarch64
No response
I have an index that avoid's duplicate username. I would like it to throw specific request so I can handle it.
(Error { kind: Query, message: "failed to perform query; Database index `username_idx` already contains 'admin', with record `user:ce7psl4jqouice6j35ug`" })
Set kind as DuplicateIndex(username_idx)
or some other error code.
Need to use string contains.
Release v1.0.0-beta.8
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.