-
Version 4 (RC 1) Pre-Release
released this
2024-08-19 23:39:14 +00:00 | 8 commits to main since this releaseVersion 4 is an evolution of this library to support better types (including treating numbers as numbers), generate IDs for documents, and support both queries on multiple fields and order of results without having to resort to custom SQL. This did bring some breaking changes, but there is also a
Compatnamespace that can be used to soften some of those to deprecation warnings, allowing you to upgrade without breaking the build.The migration guide is a work-in-progress at the time of this release, but will be fully fleshed out before v4 is released for good. The remainder of the documentation at that site has been updated for version 4, including configuring automatic IDs and ordering query results.
From the v4 pull request, a slightly-organized list of features and breaking changes:
- BREAKING CHANGE: All
*byField/*ByFieldfunctions are now*byFields/*ByFields, and take aFieldMatchcase before the list of fields. TheCompatnamespace in both libraries will assist in this transition. In support of this change, theFieldparameter name is optional; the library will generate parameter names for it if they are not specified. - BREAKING CHANGE: The
Querynamespaces have had some significant work, particularly from the full-query perspective. Most have been broken up into the base query and modifiersby*that will combine the base query with theWHEREclause needed to satisfy the criteria. - FEATURE / BREAKING CHANGE: PostgreSQL document fields will now be cast to numeric if the parameter value passed to the query is numeric. This drove the
Querybreaking changes, as the fields need to have their intended value for the library to generate the appropriate SQL. Additionally, if code assumes the library can be given something like8and transform it to"8", this is no longer the case. - FEATURE: All
Findqueries (exceptbyId/ById) now have a version with theOrderedsuffix. These take a list of fields by which the query should be ordered. A newFieldmethod calledNamedcan assist with creating these fields. Prefixing the field name withn:will cast the field to numeric in PostgreSQL (and will be ignored by SQLite); adding " DESC" to the field name will sort it descending (Z-A, high to low) instead of ascending (A-Z, low to high). - FEATURE: The library can now generate IDs for documents. It can generate a "max-plus-1" for numeric IDs, GUID strings, or random hexadecimal strings of a configurable length.
- BREAKING CHANGE (PostgreSQL only):
fieldNameParam/Parameters.FieldNameare now plural. The function still only generates one parameter, but the name is now the same between PostgreSQL and SQLite. The goal of this library is to abstract the differences away as much as practical, and this furthers that end. There are functions with these names in theCompatnamespace. - FEATURE: In the F# v3 library, lists of parameters were expected to be F#'s
Listtype, and the C# version took eitherList<T>orIEnumerable<T>. In this version, these all expectseq/IEnumerable<T>. F#'sListsatisfies theseqconstraints, so this should not be a breaking change. - FEATURE:
Fields now may have qualifiers; this allows tables to be aliased when joining multiple tables (as all have the samedatacolumn). F# users can usewithto specify this at creation, and both F# and C# can use theWithQualifiermethod to create a field with the qualifier specified. Parameter names for fields may be specified in a similar way, substitutingParameterNameforQualifier.
Downloads
- BREAKING CHANGE: All