Expand description
Things Core - Core library for Things 3 database access and data models
This library provides high-performance access to the Things 3 database, with comprehensive data models and efficient querying capabilities.
§Features
- Async Database Access: Built on SQLx for type-safe, async database operations
- Comprehensive Data Models: Full support for Tasks, Projects, Areas, and Tags
- Bulk Operations: Efficient batch operations with transactional guarantees
- Caching Layer: High-performance caching with configurable TTL
- Export Support: Multiple export formats (JSON, CSV, OPML, Markdown)
- Observability: Built-in metrics, logging, and health checks
- Performance Monitoring: Query performance tracking and optimization suggestions
§Quick Start
use things3_core::{ThingsDatabase, ThingsError};
use std::path::Path;
// Connect to Things 3 database
let db = ThingsDatabase::new(Path::new("/path/to/things.db")).await?;
// Get inbox tasks
let tasks = db.get_inbox(None).await?;
println!("Found {} tasks in inbox", tasks.len());
// Search for tasks
let results = db.search_tasks("meeting").await?;
println!("Found {} matching tasks", results.len());§Examples
See the examples directory for more comprehensive usage examples.
§Crate Features
default: Minimal feature set (core functionality only)export-csv: Enable CSV export supportexport-opml: Enable OPML export supportobservability: Enable metrics, tracing, and health checksfull: Enable all optional featurestest-utils: Enable test utilities (for testing only)
Re-exports§
pub use backup::BackupManager;pub use backup::BackupMetadata;pub use backup::BackupStats;pub use cache::CacheConfig;pub use cache::CacheStats;pub use cache::ThingsCache;pub use cache_invalidation_middleware::CacheInvalidationHandler;pub use cache_invalidation_middleware::CacheInvalidationMiddleware;pub use cache_invalidation_middleware::InvalidationConfig;pub use cache_invalidation_middleware::InvalidationEvent;pub use cache_invalidation_middleware::InvalidationEventType;pub use cache_invalidation_middleware::InvalidationRule;pub use cache_invalidation_middleware::InvalidationStats;pub use cache_invalidation_middleware::InvalidationStrategy;pub use config::ThingsConfig;pub use config_hot_reload::ConfigChangeHandler;pub use config_hot_reload::ConfigHotReloader;pub use config_hot_reload::ConfigHotReloaderWithHandler;pub use config_hot_reload::DefaultConfigChangeHandler;pub use config_loader::load_config;pub use config_loader::load_config_from_env;pub use config_loader::load_config_with_paths;pub use config_loader::ConfigLoader;pub use database::get_default_database_path;pub use database::ComprehensiveHealthStatus;pub use database::DatabasePoolConfig;pub use database::DatabaseStats;pub use database::PoolHealthStatus;pub use database::PoolMetrics;pub use database::SqliteOptimizations;pub use database::ThingsDatabase;pub use disk_cache::DiskCache;pub use disk_cache::DiskCacheConfig;pub use disk_cache::DiskCacheStats;pub use error::Result;pub use error::ThingsError;pub use mcp_cache_middleware::MCPCacheConfig;pub use mcp_cache_middleware::MCPCacheEntry;pub use mcp_cache_middleware::MCPCacheMiddleware;pub use mcp_cache_middleware::MCPCacheStats;pub use mcp_config::McpServerConfig;pub use models::DeleteChildHandling;pub use performance::CacheMetrics;pub use performance::ComprehensivePerformanceSummary;pub use performance::OperationMetrics;pub use performance::PerformanceMonitor;pub use performance::PerformanceStats;pub use performance::PerformanceSummary;pub use performance::QueryMetrics;pub use query_cache::QueryCache;pub use query_cache::QueryCacheConfig;pub use query_cache::QueryCacheStats;pub use query_performance::ImplementationEffort;pub use query_performance::OptimizationPriority;pub use query_performance::OptimizationType;pub use query_performance::QueryContext;pub use query_performance::QueryOptimizationSuggestion;pub use query_performance::QueryPerformanceMetrics;pub use query_performance::QueryPerformanceStats;pub use query_performance::QueryPerformanceSummary;pub use query_performance::QueryPerformanceTracker;pub use models::*;
Modules§
- backup
- Backup and restore functionality for Things 3 database
- cache
- Caching layer for frequently accessed Things 3 data
- cache_
invalidation_ middleware - Cache invalidation middleware for data consistency
- config
- Configuration management for Things 3 integration
- config_
hot_ reload - Configuration Hot Reloading
- config_
loader - Configuration Loader
- database
- Database module - organized submodules for better maintainability
- disk_
cache - L2 Disk cache implementation using
SQLitefor persistent caching - error
- Error types for the Things Core library
- mcp_
cache_ middleware - Caching middleware for MCP (Model Context Protocol) tool results
- mcp_
config - MCP Server Configuration Management
- models
- Data models for Things 3 entities
- performance
- Performance monitoring and metrics for Things 3 operations
- query
- Query builder for filtering and searching tasks
- query_
cache - L3 Database query result cache with smart invalidation
- query_
performance - Database query performance tracking and optimization
Structs§
- Date
Time - Re-export commonly used types ISO 8601 combined date and time with time zone.
- Naive
Date - Re-export commonly used types ISO 8601 calendar date without timezone. Allows for every proleptic Gregorian date from Jan 1, 262145 BCE to Dec 31, 262143 CE. Also supports the conversion from ISO 8601 ordinal and week date.
- Utc
- Re-export commonly used types The UTC time zone. This is the most efficient time zone when you don’t need the local time. It is also used as an offset (which is also a dummy type).
- Uuid
- A Universally Unique Identifier (UUID).
Traits§
- Deserialize
- A data structure that can be deserialized from any data format supported by Serde.
- Serialize
- A data structure that can be serialized into any data format supported by Serde.