{"id":16453904,"url":"https://github.com/auser/dbspec","last_synced_at":"2026-06-17T07:31:51.283Z","repository":{"id":237559128,"uuid":"794742051","full_name":"auser/dbspec","owner":"auser","description":"database introspection","archived":false,"fork":false,"pushed_at":"2024-05-01T22:17:05.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-26T20:44:03.022Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/auser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-05-01T21:20:03.000Z","updated_at":"2024-05-08T17:53:09.000Z","dependencies_parsed_at":"2024-05-02T14:59:37.824Z","dependency_job_id":"6979de13-a653-4e29-8340-4cc2616c0dec","html_url":"https://github.com/auser/dbspec","commit_stats":null,"previous_names":["auser/dbspec"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/auser/dbspec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auser%2Fdbspec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auser%2Fdbspec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auser%2Fdbspec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auser%2Fdbspec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/auser","download_url":"https://codeload.github.com/auser/dbspec/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auser%2Fdbspec/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34439294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"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":[],"created_at":"2024-10-11T10:17:19.241Z","updated_at":"2026-06-17T07:31:51.260Z","avatar_url":"https://github.com/auser.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Db Introspection Crate\n\nA database introspection and generator library.\n\n## Overview\n\nThis crate gives you the ability to create fake data for your living live database. \n\n## Features\n\n- Connect to PostgreSQL or MySQL databases using asynchronous operations.\n- Retrieve detailed information about tables including their names, types, and schemas.\n- Fetch column details such as name, data type, and nullability.\n- Generate fake data with a simple macro\n\n## Usage\n\nTo use this crate, ensure you have a PostgreSQL or MySQL database running and accessible. You can specify the connection string to your database when running the main application, which utilizes this crate to fetch and display the database schema information.\n\n### Library usage\n\n### Fetching columns and their types\n\nTo get a list of all your tables, use the `get_tables()` function:\n\n```rust\nuse dbspec::get_tables;\n\n#[tokio::main]\nasync fn main() {\n    let all_my_tables = get_tables(\"connection_string\").await;\n    // ...\n}\n```\n\nYou'll have the ability to generate fake data by using the `faking!()` macro.\n\n```rust\nuse dbspec::faking;\nuse dbspec::fakeit; // or your choice of faking libraries\n\nfaking!(\n    Id, id: String, || unique::uuid_v4();\n    CreatedAt, created_at: chrono::DateTime\u003cUtc\u003e, random_datetime;\n    UpdatedAt, updated_at: chrono::DateTime\u003cUtc\u003e, random_datetime;\n    Gender, gender: String, || gender();\n    Age, age: i32, || random_number_between(18, 100);\n);\n\nfn random_number_between(start: i32, end: i32) -\u003e i32 {\n    rand::thread_rng().gen_range(start..=end)\n}\nfn random_datetime() -\u003e DateTime\u003cUtc\u003e {\n    let data = datetime::date();\n    DateTime::from_timestamp(data.secs, data.nsecs).expect(\"invalid or out-of-range datetime\")\n}\n```\n\nWhere this really comes in handy is mapping columns to get a random value of your design, for instance:\n\n```rust\nasync fn generate_new_user() {\n    for i in 0..10 {\n        let user = User {\n            id: match_struct(\"id\"),\n            username: match_struct(\"username\"),\n        }\n    }\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauser%2Fdbspec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauser%2Fdbspec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauser%2Fdbspec/lists"}