Skip to content

Releases: JordanMarr/SqlHydra

v2.5.3

21 Oct 04:30
Compare
Choose a tag to compare

SqlHydra.Cli

  • Added timestamp mapping for SQL Server #103
  • Merged MySql code gen #101

v2.6.0-beta.1 - MySQL Beta Support

14 Aug 19:06
a6e9cd7
Compare
Choose a tag to compare
Pre-release

This beta release adds type generation support to SqlHydra.Cli for MySQL. (Thanks to @RJSonnenberg for the contribution!)

v2.5.0

17 May 18:39
Compare
Choose a tag to compare

SqlHydra.Query v2.5.0

  • In a select query, specifying a table or tables using the select keyword now explicitly selects all the columns in the table record; previously, it would issue a select tbl.* query. It is now recommended to always explicitly select a table. (If you do not explicitly select, it will generate a select tbl.* style query which will be less performant.)

Ex:

❌ This will issue a SELECT * query which will result in a table scan which will result in slightly worse performance.

    let! results = 
        selectTask' openContext {
            for p in Person.Person do
            take 10
        }

✅ This will explicity select all columns in the Person table, which will result in slightly better performance.

    let! results = 
        selectTask' openContext {
            for p in Person.Person do
            take 10
            select p
        }

SqlHydra.Cli v2.5.0

  • The generated HydraReader now filters out any columns that do not exist in the selected table record(s). (This fixes a bug that could happen when a column was added to a table and the types were not regenerated.

NOTE: You must upgrade both SqlHydra.Query and SqlHydra.Cli at the same time to v2.5.x.

v2.4.1

23 Apr 17:13
Compare
Choose a tag to compare

SqlHydra.Query

  • Added implicit conversions to ContextType.

The ContextType (Shared, Create, CreateAsync and CreateTask) is now implicitly converted.
This allows you to either pass in a QueryContext or a function that returns a QueryContext to your selectTask and selectAsync expressions. This is a huge quality-of-life improvement, IMO!

See Select Builders in readme for more examples.

Old:

let getErrorNumbers () =
    selectAsync HydraReader.Read (Create openContext) {
        for e in dbo.ErrorLog do
        select e.ErrorNumber
    }

Becomes:

let getErrorNumbers () =
    selectAsync HydraReader.Read openContext {
        for e in dbo.ErrorLog do
        select e.ErrorNumber
    }

Old:

let getErrorNumbers (ctx: QueryContext) =
    selectAsync HydraReader.Read (Shared ctx) {
        for e in dbo.ErrorLog do
        select e.ErrorNumber
    }

Becomes:

let getErrorNumbers (ctx: QueryContext) =
    selectAsync HydraReader.Read ctx {
        for e in dbo.ErrorLog do
        select e.ErrorNumber
    }

If you create a shortcut select CE that embeds the generated HydraReader.Read function, it becomes even more succinct:

let selectTask' ct = selectTask HydraReader.Read ct

let distinctCustomerNames (ctx: QueryContext) = 
    selectTask' ctx {
        for c in SalesLT.Customer do
        select (c.FirstName, c.LastName)
        distinct
    }

v2.4.0

21 Apr 18:57
Compare
Choose a tag to compare

SqlHydra.Cli

  • Rewrote code generation using Fabulous.AST!

  • Added new mutable_properties option to toml which makes all record properties mutable. 🙀 (defaults to false.)

  • Added new nullable_property_type option to toml which allows nullable columns to be generated as either F# option types (default) or System.Nullable properties. The latter can be useful for C# interop or CRUD scenarios where you want to data bind generated types directly to UI controls. (Generally, I would recommend mapping generated types to domain entities or DTOs, but it's nice to have the option to do things in a quick and dirty way.)

    • mutable_properties = true
    • nullable_property_type = "Nullable"
  • Improved CLI Output

    • The entire TOML configuration is now printed to CLI
    • TOM include/exclude filters are now printed to CLI, along with the number of tables generated (post-filter) and the total number of tables found (pre-filter) to the console. #88
      image
  • All providers will now ignore any tables / views with no columns (just in case)

  • Postgres "time with time zone" columns now generate DateTimeOffset properties

  • Postgres now generates materialized views (requires net8 and npgsql v8 or greater). #84

  • Updated CLI to latest "Microsoft.Data.SqlClient" to fix warnings

SqlHydra.Query

  • Changes to support the new System.Nullable column/properties in the Linq query syntax

  • Changes to support the new System.Nullable column/properties query parameters

  • Adds CreateTask and CreateAsync cases to the ContextType discriminated union. #89

  • Exposed KataQuery property on all queries (the resulting type of query builders) to make it possible to manipulate the underlying SqlKata query for inserts, updates and selects before executing the query.

  • Added head custom operation to the SelectBuilder for queries where you know there should always be at least one result. (Before you had to use tryHead, and then manually extract the value.)

v2.4.0-beta.6

20 Apr 22:57
9891241
Compare
Choose a tag to compare
v2.4.0-beta.6 Pre-release
Pre-release

SqlHydra.Query

  • Adds CreateTask and CreateAsync cases to the ContextType discriminated union.

SqlHydra.Cli

  • Updates to the latest version of Fabulous.AST for code generation

v2.4.0-beta.5

26 Mar 14:43
9891241
Compare
Choose a tag to compare
v2.4.0-beta.5 Pre-release
Pre-release

SqlHydra.Cli

  • Now prints the active filters, number of tables generated (post-filter) and the total number of tables found (pre-filter) to the console. #88

SqlHydra.Query

  • No changes.

v2.4.0-beta.4

24 Mar 04:56
9891241
Compare
Choose a tag to compare
v2.4.0-beta.4 Pre-release
Pre-release

SqlHydra.Cli

  • Rewrote the code gen. using Fabulous.AST

SqlHydra.Query

  • No changes

v2.4.0-beta.3 Support for Nullable / Mutable

09 Mar 21:16
Compare
Choose a tag to compare

SqlHydra.Cli

  • Added new tom configuration options to generate mutable properties and System.Nullable properties. This can be useful for CRUD scenarios where you want to data bind generated types directly to UI controls. (Generally, I would recommend mapping generated types to domain entities or DTOs, but it's nice to have the option to do things in a quick and dirty way.)
    • mutable_properties = true
    • nullable_property_type = "Nullable"

SqlHydra.Query

  • Added head custom operation to the SelectBuilder for queries where you know there should always be at least one result. (Before you had to use tryHead, and then manually extract the value.)
  • Changes to support the new System.Nullable column/properties in the Linq query syntax
  • Changes to support the new System.Nullable column/properties query parameters

v2.4.0-beta.2 Npgsql Improvements

06 Mar 00:38
Compare
Choose a tag to compare
Pre-release
  • Adds mappings for the materialized view columns
  • "time with time zone" columns now generate DateTimeOffset properties