{"id":14969918,"url":"https://github.com/imthesquid/goldleaf","last_synced_at":"2026-02-07T23:03:55.838Z","repository":{"id":204763314,"uuid":"712623469","full_name":"ImTheSquid/goldleaf","owner":"ImTheSquid","description":"A thin wrapper around MongoDB to make it shine!","archived":false,"fork":false,"pushed_at":"2025-11-16T20:35:09.000Z","size":104,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-16T22:14:23.131Z","etag":null,"topics":["database","mongodb","odm","orm","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ImTheSquid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-31T20:59:47.000Z","updated_at":"2025-11-16T20:35:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"c6f591d5-8db0-4962-a86a-7adc22f23c54","html_url":"https://github.com/ImTheSquid/goldleaf","commit_stats":null,"previous_names":["imthesquid/goldleaf"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ImTheSquid/goldleaf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImTheSquid%2Fgoldleaf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImTheSquid%2Fgoldleaf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImTheSquid%2Fgoldleaf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImTheSquid%2Fgoldleaf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ImTheSquid","download_url":"https://codeload.github.com/ImTheSquid/goldleaf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImTheSquid%2Fgoldleaf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29211599,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T22:58:45.823Z","status":"ssl_error","status_checked_at":"2026-02-07T22:58:45.272Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["database","mongodb","odm","orm","rust"],"created_at":"2024-09-24T13:42:41.197Z","updated_at":"2026-02-07T23:03:55.826Z","avatar_url":"https://github.com/ImTheSquid.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Goldleaf\n\nA thin wrapper over MongoDB to make it shine! Goldleaf uses struct field annotations to manage indexing, while also providing an `auto_collection` function for easy collection access.\n\nHere's a small example of annotations:\n```rust\n#[derive(Serialize, Deserialize, CollectionIdentity, Debug, Default)]\n#[db(name = \"user\")]\npub struct User {\n    /// The unique ID of the user\n    #[db(native_id_field)]\n    #[serde(rename = \"_id\", skip_serializing_if = \"Option::is_none\")]\n    pub id: Option\u003cID\u003e,\n    /// The name of the user\n    pub name: String,\n    /// The unique username of the user\n    #[db(indexing(index = 1, unique))]\n    pub username: String,\n    /// When the user was last active\n    #[serde(with = \"chrono_datetime_as_bson_datetime\")]\n    pub last_active: DateTime\u003cUtc\u003e,\n    /// The user's email\n    #[db(indexing(index = 1, unique, pfe = r#\"\"email\": {\"$type\": \"string\"}\"#))]\n    pub email: Option\u003cString\u003e,\n    /// The user's phone number\n    #[db(indexing(index = 1, unique))]\n    pub phone_number: String,\n    /// The user's sessions\n    #[db(indexing(\n        index = 1,\n        unique,\n        sub = \"token\",\n        pfe = r#\"\"sessions.token\": {\"$exists\": true}\"#\n    ))]\n    pub sessions: Vec\u003cSession\u003e,\n}\n```\n\nDon't forget the annotation on your ID field! The ID field is what is used to save the document. Use `native_id_field` to prefix your ID field with an underscore (as you would do for the `id` field). Otherwise, just use `id_field` (which automatically creates a unique index on the field).\n\nTo use the indices, call this function early in your code:\n```rust\nUser::create_indices(\u0026database).await?;\n```\nNote: This function will only exist if you create indices on your collection.\n\nThe API for MongoDB is mostly the same, but collection names are now statically-applied:\n```rust\nlet users = db.auto_collection::\u003cUser\u003e();\nlet username_matches = users\n    .find_one(doc! {\"username\": \u0026info.username}, None)\n    .await?;\n```\n\nGiven an instance of a struct, `save` can also be called:\n```rust\nuser.save(\u0026db).await?;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimthesquid%2Fgoldleaf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimthesquid%2Fgoldleaf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimthesquid%2Fgoldleaf/lists"}