factory-m8
Core traits for test data factories with automatic FK resolution.
This crate provides the foundational traits used by factory-m8-derive to generate test factories that automatically create database dependencies.
Installation
[]
= "0.1"
= "0.1"
Traits
FactoryCreate<Pool>
The main trait for factories that create entities in a database. Generic over the connection pool type, so it works with any database backend.
use ;
use async_trait;
use PgPool;
Sentinel
Trait for detecting "sentinel" values that trigger auto-creation of FK dependencies.
use Sentinel;
;
Built-in implementations for: i16, i32, i64, u32, u64, String, and Option<T>.
Database Backends
FactoryCreate is generic over the pool type, supporting any database:
| Backend | Pool Type |
|---|---|
| PostgreSQL | sqlx::PgPool |
| SQLite | sqlx::SqlitePool |
| MySQL | sqlx::MySqlPool |
| MongoDB | mongodb::Database |
License
MIT License - see LICENSE for details.