Db Introspection Crate
A database introspection and generator library.
Overview
This crate gives you the ability to create fake data for your living live database.
Features
- Connect to PostgreSQL or MySQL databases using asynchronous operations.
- Retrieve detailed information about tables including their names, types, and schemas.
- Fetch column details such as name, data type, and nullability.
- Generate fake data with a simple macro
Usage
To 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.
Library usage
Fetching columns and their types
To get a list of all your tables, use the get_tables() function:
use get_tables;
async
You'll have the ability to generate fake data by using the faking!() macro.
use faking;
use fakeit; // or your choice of faking libraries
faking!;
Where this really comes in handy is mapping columns to get a random value of your design, for instance:
async