1.0.0-beta.1
Pre-release
Pre-release
juanluispaz
released this
29 Dec 19:07
·
619 commits
to master
since this release
Changes:
- Implements reusable fragments as functions using the
buildFragmentWithArgs
function with thearg
andvalueArg
functions (all defined in the connection) - Implements reusable fragments as functions that allow creating
*IfValue
functions using thebuildFragmentWithArgsIfValue
function with thearg
andvalueArg
functions (all defined in the connection) - Add support to the newest Better Sqlite 3 returning bingint
- Update all dependencies, and apply all required changes
- Implements the method
execute
in the query runners to allows have direct access to the database using the raw objects used to establish the connection - Refactor how const values are handled. Now value source included two new methods:
isConstValue(): boolean
that allows verify if it contains a const valuegetConstValue(): TYPE
that allows getting the value of a const value source (throw an error if it is not a const value source)
- Update the readme to include explanations about dynamic queries
- Add support to
bigint
column type - Add examples section to the readme
Braking changes:
- Don't inline true or false values when they are defined with the const function. If you want a true or false value inlined use the
true()
andfalse()
methods defined in the connection - Rename
QueryRunner.getNativeConnection
asgetNativeRunner
to avoid confusion because this method doesn't return the connection in all the implementation (could be the pool) - Big refactor to reduce the pressure on TypeScript type validations. Breaking changes:
- Connections classes now only receive one generic argument with a unique name.
Before:DBConection extends PostgreSqlConnection<DBConection, 'DBConnection'> { }
After:DBConection extends PostgreSqlConnection<'DBConnection'> { }
- Tables and views now receive a second generic argument with a unique name.
Before:class TCompany extends Table<DBConection> { ... }
After:class TCompany extends Table<DBConection, 'TCompany'> { ... }
Before:class VCustomerAndCompany extends View<DBConection> { ... }
After:class VCustomerAndCompany extends View<DBConection, 'VCustomerAndCompany'> { ... }
- Connections classes now only receive one generic argument with a unique name.
- The value argument and the return type in the type adapters (including the default implementation in the connection) have now type
unknown
- Trak if a value source is optional and validates if the result of executing a query return a value when it is expected. Braking changes:
- A const with an optional value must be created using the new
optionalConst
function in the connection, previously was used theconst
function in the connection - The
is
function that allows comparing two values now returns a not optional boolean, previously it returned an optional value
- A const with an optional value must be created using the new
- Dropped the method
NumberValueSource.asStringNumber
, use instead the new methods:NumberValueSource.asInt(): number
NumberValueSource.asDouble(): number
NumberValueSource.asStringInt(): number|string
NumberValueSource.asStringDouble(): number|string
StringNumberValueSource.asStringInt(): number|string
StringNumberValueSource.asStringDouble(): number|string
Internal changes:
- Big refactor without change the public interface:
- Use symbols for type marks instead of protected fields
- Use interfaces instead of abstract classes (allowed by the previous change)
- Use import type when it is possible
- Join all databases files in one file
- Drop alternative implementations code not in use
Bug fixes:
- Fix invalid query when no value is provided to the function
concatIfValue
- Fix invalid usage of
*IfValue
functions result, now typescript report an error when it happens - Handle when the update has nothing to set, in that case, no update will be performed, and it returns 0 rows updated