Releases: JordanMarr/SqlHydra
v2.5.3
v2.6.0-beta.1 - MySQL Beta Support
This beta release adds type generation support to SqlHydra.Cli for MySQL. (Thanks to @RJSonnenberg for the contribution!)
v2.5.0
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 aselect tbl.*
query. It is now recommended to always explicitlyselect
a table. (If you do not explicitly select, it will generate aselect 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
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
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) orSystem.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
-
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
andCreateAsync
cases to theContextType
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 theSelectBuilder
for queries where you know there should always be at least one result. (Before you had to usetryHead
, and then manually extract the value.)
v2.4.0-beta.6
SqlHydra.Query
- Adds
CreateTask
andCreateAsync
cases to theContextType
discriminated union.
SqlHydra.Cli
- Updates to the latest version of Fabulous.AST for code generation
v2.4.0-beta.5
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
SqlHydra.Cli
- Rewrote the code gen. using Fabulous.AST
SqlHydra.Query
- No changes
v2.4.0-beta.3 Support for Nullable / Mutable
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 theSelectBuilder
for queries where you know there should always be at least one result. (Before you had to usetryHead
, 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
- Adds mappings for the materialized view columns
- "time with time zone" columns now generate DateTimeOffset properties