How bradleyboy/tuql works
Main Components
a) Input Layer:
• SQLite Database File Input
• SQL File Input (for in-memory database)
• Command-line Interface (CLI)
b) Core Processing Components:
• Schema Builder
• Query Builder
• Relationship Inference Engine
• Mutation Generator
c) Output Layer:
• GraphQL Server
• GraphiQL Interface (optional)
• Schema Export Functionality
┌─ Input Layer ─┐
• CLI Args │
• SQLite/SQL │
• ┬───────┘
• ▼
┌─ Core Layer ──────────────────┐
• ┌─ Schema Builder ─┐ │
• Definitions │ │
• Arguments │──┐ │
• Associations │ │ │
• ┘ │ │
• ┌─ Query Engine ─┐ │ │
• Resolvers │◄─┘ │
• Mutations │ │
• ┘ │
• ┬─────────────────┘
• ▼
┌─ Output Layer ─┐
• GraphQL API │
• GraphiQL │
• ┘
Component Details
Schema Builder Section:
• Three main builders (definitions.js, arguments.js, associations.js)
• Relationship inference logic
• Supported relationship types (belongsTo, hasMany, belongsToMany)
Query Engine Section:
• CRUD operation support
• Mutation capabilities
• Relationship resolution logic
Additional Elements
• The relationship inference rules (id naming conventions)
• Table naming conventions for many-to-many relationships
• Foreign key detection capabilities
Technical Details
Integration points:
• CLI argument processing
• Database connection handling
• GraphQL server setup
• Schema export functionality
Implementation Notes
• The modular builder pattern used
• The separation of concerns between builders
• The utility functions support
• The test coverage for each component
Remember to include a note about the tool's flexibility in handling both foreign key-based and naming convention-based relationship inference, as this is a key feature of the system.