{"id":23486943,"url":"https://github.com/romanhodulak/basex-rs","last_synced_at":"2025-08-27T07:05:43.525Z","repository":{"id":48365014,"uuid":"215411034","full_name":"RomanHodulak/basex-rs","owner":"RomanHodulak","description":"Client implementation of the open source XML database server and XQuery processor BaseX (see http://basex.org) for Rust.","archived":false,"fork":false,"pushed_at":"2023-02-04T04:59:01.000Z","size":223,"stargazers_count":15,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-20T23:57:43.918Z","etag":null,"topics":["basex","database","rust","xml","xpath","xquery"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RomanHodulak.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-10-15T22:55:36.000Z","updated_at":"2024-03-17T11:24:21.000Z","dependencies_parsed_at":"2023-02-18T14:00:50.488Z","dependency_job_id":null,"html_url":"https://github.com/RomanHodulak/basex-rs","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/RomanHodulak/basex-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RomanHodulak%2Fbasex-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RomanHodulak%2Fbasex-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RomanHodulak%2Fbasex-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RomanHodulak%2Fbasex-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RomanHodulak","download_url":"https://codeload.github.com/RomanHodulak/basex-rs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RomanHodulak%2Fbasex-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272301952,"owners_count":24910091,"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","status":"online","status_checked_at":"2025-08-27T02:00:09.397Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["basex","database","rust","xml","xpath","xquery"],"created_at":"2024-12-24T22:17:49.842Z","updated_at":"2025-08-27T07:05:43.466Z","avatar_url":"https://github.com/RomanHodulak.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv style=\"text-align: center\"\u003e\n\n# ![BaseX Logo](https://basex.org/images/basex.svg \"BaseX\")\n\n[![Build Status](https://github.com/RomanHodulak/basex-rs/actions/workflows/rust.yml/badge.svg)](https://github.com/RomanHodulak/basex-rs/actions)\n[![Code Coverage](https://codecov.io/gh/RomanHodulak/basex-rs/branch/master/graph/badge.svg?token=GDG9C63SNE)](https://codecov.io/gh/RomanHodulak/basex-rs)\n[![Current Crates.io Version](https://img.shields.io/crates/v/basex.svg)](https://crates.io/crates/basex)\n[![Documentation](https://docs.rs/basex/badge.svg)](https://docs.rs/basex)\n[![Current Crates.io Downloads](https://img.shields.io/crates/d/basex.svg)](https://crates.io/crates/basex)\n\n\u003c/div\u003e\n\nThis library is a client implementation of the open-source XML database server and XQuery processor [BaseX](http://basex.org).\n\nCompatible with versions 8.x and 9.x.\n\n## Installation\nAdd the library to the list of dependencies in your `Cargo.toml` like so:\n\n```toml\n[dependencies]\nbasex = \"0.7.0\"\n```\n\n## Usage\n\n### 1. Set up a database server\nFirst, you need to have BaseX server up and running. If you want to try it out, you can do it right away using docker.\n\n```shell\ndocker run -p 1984:1984 basex/basexhttp:9.5.2\n```\n\nEvery example can be run with this server configuration.\n\n### 2. Connect to the server\nBefore you can do anything with the database server, you need to establish connection and authorize. Typically, you do this by calling `Client::connect`. If you get Ok result, you get the instance of the `Client`. Having its instance guarantees to have an open session with the server.\n\n```rust\nlet client = Client::connect(\"localhost\", 1984, \"admin\", \"admin\")?;\n```\n\nYou can now send commands.\n\n### 3. Open database\nTo run a query, you need to open a database.\n\n#### 3.1. Create a new database\nCreating a database also opens it. Follow the create call with either `without_input` or `with_input` to optionally specify initial XML resource.\n\n```rust\nlet info = client.create(\"coolbase\")?.with_input(\u0026mut xml)?;\n```\n\n#### 3.2. Open an existing database\nUse `Client::execute` with command [`OPEN [name]`](https://docs.basex.org/wiki/Commands#OPEN).\n\n```rust\nlet (client, info) = client.execute(\"OPEN coolbase\")?.close()?;\n```\n\n### 4. Run queries\nAside from running commands, you can run queries using XQuery syntax which is the most important use-case.\n\n1. Create a new query using `Client::query`. This puts the session into query mode. \n2. Optionally, bind arguments using `Query::bind`. \n3. Execute it using `Query::execute`.\n4. Close the query using `Query::close`.\n\n## Example\nThe following example creates database \"lambada\" with initial XML resource and counts all first-level child nodes of the `Root` node.\n\n```rust\nuse basex::{Client, ClientError};\nuse std::io::Read;\n\nfn main() -\u003e Result\u003c(), ClientError\u003e {\n    let mut client = Client::connect(\"localhost\", 1984, \"admin\", \"admin\")?;\n    let info = client.create(\"lambada\")?\n        .with_input(\"\u003cRoot\u003e\u003cText/\u003e\u003cLala/\u003e\u003cPapa/\u003e\u003c/Root\u003e\")?;\n    assert!(info.starts_with(\"Database 'lambada' created\"));\n\n    let query = client.query(\"count(/Root/*)\")?;\n\n    let mut result = String::new();\n    let mut response = query.execute()?;\n    response.read_to_string(\u0026mut result)?;\n    assert_eq!(result, \"3\");\n\n    let mut query = response.close()?;\n    query.close()?;\n    Ok(())\n}\n```\n\n## License\nThe library is licensed under [ISC](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromanhodulak%2Fbasex-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fromanhodulak%2Fbasex-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromanhodulak%2Fbasex-rs/lists"}