Skip to content

Conversation

@MelbourneDeveloper
Copy link
Owner

F# Type Provider for LQL with Compile-Time Validation

TLDR;

Adds an F# type provider that validates LQL queries at compile time, converting them to SQL. Invalid LQL syntax causes compilation errors rather than runtime failures.

Brief Details

  • LqlTypeProvider: New F# type provider (Lql.LqlCommand<"query">) that parses LQL at compile time, validates syntax, and generates SQL
  • Compile-time errors: Invalid LQL queries fail the build with descriptive error messages including line/column positions
  • Generated properties: Each validated query type exposes Query (original LQL) and Sql (generated SQL) static properties
  • E2E test suite: 30+ tests covering selects, filters, joins, aggregations, ordering, limits, and arithmetic expressions
  • Test data seeder: C# helper using DataProvider-generated extensions to seed test databases (no raw SQL inserts)
  • CI integration: New GitHub Actions job lql-fsharp-typeprovider-tests runs F# type provider tests on LQL changes
  • F# example project: Demo app showing type provider usage with .lql query files

How Do The Tests Prove This Works?

  • TypeProviderCompileTimeValidationTests: Verify Query and Sql properties are generated correctly
  • TypeProviderFilterTests: Confirm filter expressions generate proper WHERE clauses with AND/OR
  • TypeProviderJoinTests: Validate JOIN, LEFT JOIN, and multi-table joins produce correct SQL
  • TypeProviderAggregationTests: Test GROUP BY, SUM, AVG, COUNT, and HAVING clauses
  • TypeProviderE2EExecutionTests: Execute generated SQL against real SQLite database, verify row counts and data
  • TypeProviderRealWorldScenarioTests: End-to-end scenarios querying customers, filtering users, joining orders

@MelbourneDeveloper MelbourneDeveloper enabled auto-merge (squash) January 4, 2026 08:52
@MelbourneDeveloper MelbourneDeveloper merged commit b3a7fdd into main Jan 5, 2026
18 checks passed
@MelbourneDeveloper MelbourneDeveloper deleted the TypeProviderF# branch January 5, 2026 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants