Skip to content

1.0.0-beta.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@juanluispaz 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 the arg and valueArg functions (all defined in the connection)
  • Implements reusable fragments as functions that allow creating *IfValue functions using the buildFragmentWithArgsIfValue function with the arg and valueArg 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 value
    • getConstValue(): 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() and false() methods defined in the connection
  • Rename QueryRunner.getNativeConnection as getNativeRunner 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'> { ... }
  • 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 the const function in the connection
    • Theis function that allows comparing two values now returns a not optional boolean, previously it returned an optional value
  • 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