From 09a04d3531fa427b4128072b70029ec019696bcc Mon Sep 17 00:00:00 2001 From: Sergey Shekhovtsov Date: Thu, 13 Apr 2023 12:15:20 +0300 Subject: [PATCH] Fix readme --- Cargo.toml | 5 +++-- README.md | 17 +++++++++-------- src/lib.rs | 17 +++++++++-------- src/opts.rs | 2 -- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9cbcdc3..f1e767f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,12 +3,13 @@ name = "mongodb-macro" version = "0.1.0" edition = "2021" description = "MongoDB Macro is a crate with macros for quickly creating structures to work with mongodb" -keywords = [ "mongodb", "macro", "config", "clap", "opts" ] -categories = [ "mongodb", "macro" ] +keywords = [ "mongodb", "macro", "config", "clap" ] +categories = [ "config", "database", "web-programming" ] authors = ["Erritis "] readme = "README.md" license = "MIT" repository = "https://github.com/erritis/mongodb-macro" +documentation = "https://docs.rs/mongodb-macro" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/README.md b/README.md index 004e41c..d3c1357 100644 --- a/README.md +++ b/README.md @@ -20,19 +20,20 @@ use mongodb::{Client, bson::Bson}; use mongodb_macro::Parser; mongodb_macro::config!(Opts); -//equal -//mongodb_macro::config!(Opts; "DB_NAME", "COLLECTION_NAME","DB_URL"); - -//or -//mongodb_macro::config!(Opts, "MONGO"); -//equal -//mongodb_macro::config!(Opts; "MONGO_DB_NAME", "MONGO_COLLECTION_NAME","MONGO_DB_URL"); +// equivalent to +// mongodb_macro::config!(Opts; "DB_NAME", "COLLECTION_NAME", "DB_URL"); +// +// or with prefix +// +// mongodb_macro::config!(Opts, "MONGO"); +// equivalent to +// mongodb_macro::config!(Opts; "MONGO_DB_NAME", "MONGO_COLLECTION_NAME", "MONGO_DB_URL"); async fn main() -> std::io::Result<()> { let opts = Opts::parse(); - let client = mongodb::Client::with_uri_str(opts.db_url).await.expect("failed to connect"); + let client = mongodb::Client::with_uri_str(&opts.db_url).await.expect("failed to connect"); let db = client.database(&opts.db_name); let collection = db.collection::(&opts.collection_name); diff --git a/src/lib.rs b/src/lib.rs index 2aebdc2..bd46326 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,19 +8,20 @@ use mongodb::{Client, bson::Bson}; use mongodb_macro::Parser; mongodb_macro::config!(Opts); -//equal -//mongodb_macro::config!(Opts; "DB_NAME", "COLLECTION_NAME","DB_URL"); - -//or -//mongodb_macro::config!(Opts, "MONGO"); -//equal -//mongodb_macro::config!(Opts; "MONGO_DB_NAME", "MONGO_COLLECTION_NAME","MONGO_DB_URL"); +// equivalent to +// mongodb_macro::config!(Opts; "DB_NAME", "COLLECTION_NAME", "DB_URL"); +// +// or with prefix +// +// mongodb_macro::config!(Opts, "MONGO"); +// equivalent to +// mongodb_macro::config!(Opts; "MONGO_DB_NAME", "MONGO_COLLECTION_NAME", "MONGO_DB_URL"); async fn main() -> std::io::Result<()> { let opts = Opts::parse(); - let client = mongodb::Client::with_uri_str(opts.db_url).await.expect("failed to connect"); + let client = mongodb::Client::with_uri_str(&opts.db_url).await.expect("failed to connect"); let db = client.database(&opts.db_name); let collection = db.collection::(&opts.collection_name); diff --git a/src/opts.rs b/src/opts.rs index 1697c8b..9964508 100644 --- a/src/opts.rs +++ b/src/opts.rs @@ -1,5 +1,3 @@ - - /// Quick and easy creates a new configuration to connect to MongoDB /// /// Creating a configuration structure when using one database in a project: