API Reference Lotus v#0.16.5

Copy Markdown View Source

Modules

Lotus is a lightweight Elixir library for saving and executing read-only SQL queries.

AI-powered query generation for Lotus.

Behaviour for AI tool actions.

Convenience module for AI actions.

Executes a SQL query against a data source.

Retrieves distinct values for a specific column.

Retrieves column details for a specific table.

Lists all available data sources (repositories).

Lists all available database schemas.

Lists all available tables in a database.

Validates SQL syntax against the database without executing.

Manages conversational state for AI-assisted query generation.

Domain errors for AI service failures.

The AI provider rejected the request due to invalid or missing credentials.

The AI provider rejected the request due to rate limits or quota.

The AI provider returned a server-side error (5xx).

Catch-all for unexpected AI service errors.

The AI request timed out.

Analyzes SQL query errors and provides actionable suggestions.

Prompts for AI-powered SQL query explanations.

System prompts for AI-powered query optimization suggestions.

System prompts for SQL query generation.

Source-agnostic variable system documentation for AI prompts.

Generates AI-powered plain-language explanations for SQL queries.

Generates AI-powered optimization suggestions for SQL queries.

Generates SQL from natural language using ReqLLM.

Optimizes schema loading for large databases using two-stage approach.

Tool utilities for LLM interactions.

Lotus cache facade. If no adapter configured, acts as a no-op pass-through.

Behaviour specification for cache adapters in the Lotus framework.

A Cachex-based, local or distributed, in-memory cache adapter for Lotus.

An ETS-based, local, in-memory cache adapter for Lotus.

Configuration management for Lotus.

Service functions for managing dashboards in Lotus.

Export functionality for Lotus.Result to various formats.

Value normalization for export formats. Handles various database types and edge cases for CSV and JSON export.

Generic middleware pipeline for query execution and schema discovery hooks.

Migration behavior for database-specific migrations.

Migration management system for Lotus.

Initial table structure for Lotus queries on PostgreSQL.

Add lotus_query_visualizations table for storing chart configs per query.

Add dashboard tables for storing dashboard configurations, cards, filters, and mappings.

Protocol for normalizing raw database values into JSON-safe, displayable forms.

SQL preflight authorization for Lotus.

Manages preflight relations stored in the process dictionary.

Represents a filter condition to apply on query results.

Represents a sort directive to apply on query results.

Represents the result of a SQL query execution.

Computes column-level statistics from in-memory query results.

SQL execution with safety checks, param binding, and result shaping.

Shared helpers for SQL-based sources to inject filter conditions into queries.

Processes [[...]] optional clause syntax in SQL queries.

Shared helpers for cleaning SQL strings before further processing.

Shared helpers for SQL-based sources to inject sort directives into queries.

Transforms SQL queries for database-specific syntax compatibility.

Validates SQL syntax by preparing it against the database without executing.

Schema introspection functionality for Lotus.

Source behavior for database-specific operations.

Default source adapter implementation for unsupported or unknown database sources.

Storage operations for Lotus queries.

Represents a saved Lotus dashboard.

Represents a card within a Lotus dashboard.

Embedded schema for card layout in the dashboard grid.

Maps a dashboard filter to a query variable within a card.

Represents a filter control for a Lotus dashboard.

Represents a saved Lotus query.

Represents a variable placeholder ({{var}}) used inside a Lotus query.

Represents a single static option for a QueryVariable select widget.

Represents a saved visualization configuration for a Lotus query.

Caches table schema metadata for automatic type detection and casting.

Casts variable values to appropriate types based on database column types.

Behavior for implementing custom database type handlers.

Maps database column types to Lotus internal types for automatic casting.

Extracts variable-to-column bindings from SQL queries.

Top-level supervisor for Lotus.

Telemetry events emitted by Lotus.

Central value normalization for JSON/CSV/UI display.

Utilities for Lotus {{variable}} template syntax.

Schema and table visibility filtering for Lotus.

Policy builders and validators for visibility rules.

Service functions for managing query visualizations in Lotus storage.