Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sarmadgulzar/deta-rust
Deta SDK for Rust
https://github.com/sarmadgulzar/deta-rust
Last synced: 3 days ago
JSON representation
Deta SDK for Rust
- Host: GitHub
- URL: https://github.com/sarmadgulzar/deta-rust
- Owner: sarmadgulzar
- License: mit
- Created: 2021-08-01T14:37:24.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-08-03T00:42:35.000Z (over 3 years ago)
- Last Synced: 2024-10-29T20:57:19.554Z (18 days ago)
- Language: Rust
- Size: 4.88 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-deta - `data-rust` - Deta SDK for Rust. (SDK's / Rust SDK)
README
# data-rust
Deta SDK for Rust
Example:
`Cargo.toml`
```toml
[dependencies]
deta = "0.3.0"
serde = { version = "1.0.127", features = ["derive"] }
````main.rs`
```rust
use deta::base::Base;
use serde::Deserialize;#[derive(Debug, Deserialize)]
struct User {
key: String,
name: String,
age: i32,
}fn main() {
let base = Base::new(
String::from("DB_NAME"),
String::from("DB_PROJECT_KEY"),
String::from("DB_PROJECT_ID"),
);
let user: User = base
.get(String::from("krvb876h"))
.expect("There was an error!")
.json()
.expect("There was an error!");println!("{:?}", user);
}
```This will print the following to the console:
```raw
User { key: "krvb876h", name: "Sarmad", age: 25 }
```