{"id":19636243,"url":"https://github.com/kuy/jsonbox-rs","last_synced_at":"2025-04-28T08:32:16.592Z","repository":{"id":62441382,"uuid":"210151253","full_name":"kuy/jsonbox-rs","owner":"kuy","description":"Rust wrapper for jsonbox.io","archived":false,"fork":false,"pushed_at":"2019-10-04T12:45:16.000Z","size":89,"stargazers_count":8,"open_issues_count":7,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-07T09:17:58.739Z","etag":null,"topics":["binding","json","jsonbox","rust","wrapper"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kuy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-22T13:23:21.000Z","updated_at":"2022-09-08T02:56:09.000Z","dependencies_parsed_at":"2022-11-01T22:02:00.742Z","dependency_job_id":null,"html_url":"https://github.com/kuy/jsonbox-rs","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuy%2Fjsonbox-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuy%2Fjsonbox-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuy%2Fjsonbox-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuy%2Fjsonbox-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kuy","download_url":"https://codeload.github.com/kuy/jsonbox-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224102639,"owners_count":17256221,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binding","json","jsonbox","rust","wrapper"],"created_at":"2024-11-11T12:28:25.657Z","updated_at":"2024-11-11T12:28:55.277Z","avatar_url":"https://github.com/kuy.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jsonbox.rs\n\n[![crates.io](https://img.shields.io/crates/v/jsonbox.svg)](https://crates.io/crates/jsonbox)\n[![docs.rs](https://docs.rs/jsonbox/badge.svg)](https://docs.rs/jsonbox)\n[![build](https://github.com/kuy/jsonbox-rs/workflows/build/badge.svg)](https://github.com/kuy/jsonbox-rs/actions)\n\n⚙️ Rust wrapper for 📦 [jsonbox.io](https://jsonbox.io/).\n\n## Usage\n\n```rust\n// Declaration\nuse jsonbox::{Client, Error};\nuse serde::{Deserialize, Serialize};\n\n// Define struct\n#[derive(Serialize, Deserialize)]\npub struct Data {\n    pub name: String,\n    pub message: String,\n}\n\nfn main() -\u003e Result\u003c(), Error\u003e {\n    // Create client with \u003cBOX_ID\u003e\n    let client = Client::new(\"enjoy_your_first_jsonbox_rs\");\n\n    // Insert data\n    let data = Data {\n        name: \"kuy\".into(),\n        message: \"Hello, Jsonbox!\".into(),\n    };\n    let (record, meta) = client.create(\u0026data)?;\n    println!(\"CREATE: data={:?}, id={} @{}\", record, meta.id, meta.created_on);\n\n    Ok(())\n}\n```\n\nSee [full documentation](https://docs.rs/jsonbox).\n\n### CREATE\n\n```rust\nlet data = Data {\n    name: \"kuy\".into(),\n    message: \"Hello, Jsonbox!\".into(),\n};\nlet (record, meta) = client.create(\u0026data)?;\nprintln!(\"CREATE: data={:?}, meta={:?}\", record, meta);\n```\n\nUse [`create_bulk()`](https://docs.rs/jsonbox/latest/jsonbox/struct.Client.html#method.create_bulk) for bulk creation.\n\n### READ\n\n#### all (default parameters)\n\n```rust\nlet all = client.read().all::\u003cData\u003e()?;\nprintln!(\"READ: len={}, all={:?}\", all.len(), all);\n```\n\n#### with specific id\n\n```rust\nlet (record, meta) = client.read().id(\"5d876d852a780700177c0557\")?;\nprintln!(\"READ: data={:?}, meta={:?}\", record, meta);\n```\n\n#### with limit\n\n```rust\nlet few = client.read().limit(10).run::\u003cData\u003e()?;\nprintln!(\"READ: len={}, few={:?}\", few.len(), few);\n```\n\n#### with skip\n\n```rust\nlet rest = client.read().skip(5).run::\u003cData\u003e()?;\nprintln!(\"READ: len={}, rest={:?}\", rest.len(), rest);\n```\n\n#### with order (asc/desc)\n\n```rust\nlet asc = client.read().order_by(\"name\").run::\u003cData\u003e()?;\nprintln!(\"READ: len={}, asc={:?}\", asc.len(), asc);\n\nlet desc = client.read().order_by(\"count\").desc().run::\u003cData\u003e()?;\nprintln!(\"READ: len={}, desc={:?}\", desc.len(), desc);\n```\n\n#### with filter\n\n```rust\nlet filtered = client\n    .read()\n    .filter_by(\"name:{}\", \"Json Box\")\n    .run::\u003cData\u003e()?;\nprintln!(\"READ: len={}, filtered={:?}\", filtered.len(), filtered);\n```\n\nSee [QueryBuilder](https://docs.rs/jsonbox/latest/jsonbox/struct.QueryBuilder.html), [baisc example](https://github.com/kuy/jsonbox-rs/blob/master/examples/basic.rs), or [official documentation](https://github.com/vasanthv/jsonbox#filtering) for more about filters.\n\n### UPDATE\n\n```rust\nlet data = Data::new(\"kuy\", \"Hello, Jsonbox!\");\nclient.update(\"5d876d852a780700177c0557\", \u0026data)?;\nprintln!(\"UPDATE: OK\");\n```\n\n### DELETE\n\n```rust\nclient.delete(\"5d876d852a780700177c0557\")?;\nprintln!(\"DELETE: OK\");\n```\n\n## Examples\n\n- [jsonbox-todo-example](https://github.com/kuy/jsonbox-todo-example)\n- [hello](https://github.com/kuy/jsonbox-rs/blob/master/examples/hello.rs)\n  - `cargo run --example hello`\n- [basic](https://github.com/kuy/jsonbox-rs/blob/master/examples/basic.rs)\n  - `cargo run --example basic`\n- [errors](https://github.com/kuy/jsonbox-rs/blob/master/examples/errors.rs)\n  - `cargo run --example errors`\n\n## License\n\nMIT\n\n## Author\n\nYuki Kodama / [@kuy](https://twitter.com/kuy)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuy%2Fjsonbox-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkuy%2Fjsonbox-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuy%2Fjsonbox-rs/lists"}