Expand description
§revelation-bible
A comprehensive, type-safe Bible domain library for Rust applications.
This crate provides the foundational domain types and port traits for building Bible-related applications following hexagonal architecture principles. It separates domain logic from infrastructure, enabling flexible adapter implementations.
§Architecture
┌─────────────────────────────────────────────────────────────┐
│ Your Application │
├─────────────────────────────────────────────────────────────┤
│ revelation-bible │
│ ┌─────────────────────┐ ┌─────────────────────────────┐ │
│ │ Domain Types │ │ Port Traits │ │
│ │ ───────────────── │ │ ───────────────────────── │ │
│ │ Book, Verse │ │ BibleRepository │ │
│ │ CrossReference │◄───│ BibleSearch │ │
│ │ SearchResult │ │ BibleCrossReference │ │
│ │ DailyReading │ │ ReadingPlan │ │
│ └─────────────────────┘ └─────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘§Features
| Feature | Description | Dependencies |
|---|---|---|
db | SQLx type derives for PostgreSQL enum mapping | sqlx |
api | OpenAPI schema generation for REST APIs | utoipa |
backend | Repository port traits with error handling | masterror |
§Quick Start
use revelation_bible::{Book, Testament, Verse, VerseRef};
// Create a book reference
let genesis = Book {
id: 1,
name: "Genesis".into(),
name_ru: "Бытие".into(),
abbreviation: "Gen".into(),
testament: Testament::Old,
chapters_count: 50
};
// Create verse references
let single = VerseRef::single(43, 3, 16); // John 3:16
let range = VerseRef::range(45, 5, 1, 5); // Romans 5:1-5§Domain Types
§Core Bible Structure
Book- Bible book with metadata (1-66 canonical books)Verse- Individual verse with text contentChapterInfo- Chapter metadata with verse countsTestament- Old/New Testament enum
§Navigation & Study
Pericope- Section headings for navigationSearchResult- Full-text search results with highlightingCrossReference- Links between related passagesCrossReferenceExpanded- Cross-reference with full verse textVerseRef- Flexible verse/range reference
§Reading Plans
DailyReading- Daily reading assignmentVerseResponse- User reflection on readingsCreateVerseResponse- Request to create reflection
§Port Traits
When the backend feature is enabled, the following traits are available:
- [
ports::BibleRepository] - CRUD operations for Bible data - [
ports::BibleSearch] - Full-text and symphony search - [
ports::BibleCrossReference] - Cross-reference lookups - [
ports::ReadingPlan] - Daily reading plan management
§Example: Implementing a Repository
ⓘ
use revelation_bible::ports::BibleRepository;
use revelation_bible::{Book, Verse, Testament};
use masterror::AppResult;
use sqlx::PgPool;
struct PostgresBibleRepository {
pool: PgPool,
}
impl BibleRepository for PostgresBibleRepository {
async fn get_books(&self) -> AppResult<Vec<Book>> {
// Implementation using sqlx
todo!()
}
// ... other methods
}Re-exports§
pub use domain::*;
Modules§
- domain
- Bible domain types.