ts-sql-query

Type-safe SQL query builder like QueryDSL or JOOQ in Java or Linq in .Net for TypeScript with MariaDB, MySql, Oracle, PostgreSql, Sqlite and SqlServer support.

MIT License

Downloads
29.1K
Stars
284
Committers
9

Bot releases are hidden (Show)

ts-sql-query - 1.46.0

Published by juanluispaz almost 2 years ago

Changes:

  • Add onlyWhenOrNull and ignoreWhenAsNull methods that allows to create an expression that only applies if a certain condition is met; otherwise, the value will be null

Bug fixes:

  • Fix error in type definition introduced in ts-sql-query 1.42.0 that make optional properties appears as required in the query result due an over relaxed validation
ts-sql-query - 1.45.0

Published by juanluispaz almost 2 years ago

Changes:

  • Allow to use dynamicPick over tables and views past as parameter to a function
  • Improve dynamicPick to work with columns coming from other dynamicPick and to work with complex projections
  • Improve extractColumnsFrom and extractWritableColumnsFrom to receive a second optional argument with the properties to exclude
  • Add utilities functions extractColumnNamesFrom and extractWritableColumnNamesFrom that allows to get the column names from a table or view

Documentation changes:

  • Add to the FAQs ts-sql-codegen that allows to generate the tables/views models from the database

Internal changes:

  • Improve Github CI to remove some deprecated warning and include Node 18.x in the tests
ts-sql-query - 1.44.0

Published by juanluispaz almost 2 years ago

Changes:

  • Add beforeWithQuery and afterWithQuery select query customizations
  • Add utility types to allow pass tables and views as parameter

Documentation changes:

  • Add FAQs & limitations section to the documentation
  • Document select queries that references outer tables
ts-sql-query - 1.43.0

Published by juanluispaz almost 2 years ago

Changes:

ts-sql-query - 1.42.0

Published by juanluispaz almost 2 years ago

Changes:

  • Relax utility types to allow use in partial objects. This allows using Omit or Pick in combination with the utility types. Example: type PickValues<COLUMNS, KEYS extends keyof COLUMNS> = SelectedValues<Pick<COLUMNS, KEYS>>;
ts-sql-query - 1.41.0

Published by juanluispaz almost 2 years ago

Changes:

  • Implement nullIfValue function that returns null when the provided value is the same otherwise return the initial value
  • Add support to values construction that allows to create a "view" for use in the query with a list of constant provided values
  • Add support to param placeholder customisation, allowing to include type cast in the generated sql query for the param

Documentation changes:

  • Fix DBConnection typo in examples and documentation

Bug fixes:

  • Fix internal error when optional joins are used in a select page query
  • Fix internal error when join(...).on(...).and/or pattern is used
  • Fix wrong month number sent to the database when a text representation of the date is used in Sqlite
  • Fix getMonth method returning wrong value (The returning value must follow JS's Date definition) in PostgreSQL, Sqlite, MariaDB, MySQL, Oracle and SqlServer
  • Fix getSeconds, getMilliseconds over a date/time in Oracle
  • Fix getDay, getSeconds, getMilliseconds and getTime over a date/time in Oracle
ts-sql-query - 1.40.0

Published by juanluispaz almost 2 years ago

Bug fixes:

  • Fix missing parenthesis in a subtraction of a subtraction
ts-sql-query - 1.39.0

Published by juanluispaz almost 2 years ago

Changes:

  • Add support to the returning clause in MariaDB in insert and delete (update not supported yet by MariaDB)
  • Add support to Prisma 4
ts-sql-query - 1.38.0

Published by juanluispaz about 2 years ago

Bug fixes:

  • Fix select page count when a group by is used
ts-sql-query - 1.37.0

Published by juanluispaz about 2 years ago

Changes:

  • Implement allowWhen and disallowWhen that throws an error if the expression is used in the final query

Documentation changes:

  • Fix copy&paste on update documentation refering delete

Bug fixes:

  • Fix minValue and maxValue returning wrong value
  • Fix missing with query when a query in a with clause depends on another with query
ts-sql-query - 1.36.0

Published by juanluispaz about 2 years ago

Bug fixes:

  • Fix invalid uuid type in a reusable fragment
ts-sql-query - 1.35.0

Published by juanluispaz about 2 years ago

Bug fixes:

  • Fix wrong return type of min and max functions in the connection
ts-sql-query - 1.34.0

Published by juanluispaz about 2 years ago

Changes:

  • Add valueWhenNoValue function that allows to return a value when null or undefined were provided to the *IfValue function
ts-sql-query - 1.33.0

Published by juanluispaz about 2 years ago

Bug fixes:

  • Fix "Invalid double value received from the db" when the database send a number as string with trailing 0
ts-sql-query - 1.32.0

Published by juanluispaz about 2 years ago

Changes:

  • Implement onlyWhen and ignoreWhen function that allows ignoring a boolean expression under a condition
  • Add support to virtual columns on tables and views
  • Implement the types InsertableValues, UpdatableValues and SelectedValues that allows to get the types for an insert, update and select with the proper types defined in the table without the other sql objects
ts-sql-query - 1.31.0

Published by juanluispaz about 2 years ago

Bug fixes:

  • Fix misspelling in left outer join
ts-sql-query - 1.30.0

Published by juanluispaz about 2 years ago

Bug fixes:

  • Fix optional join not omitted when an IfValue is used and there is no value
ts-sql-query - 1.29.0

Published by juanluispaz over 2 years ago

Changes:

  • Export helper types in extras to retrieve row types when insert, update and select
  • Include timestamps in LoggingQueryRunner callbacks
  • Make the ConsoleLogQueryRunner more configurable so that it can output results, timestamps and durations as well

Bug fixes:

  • Fix insert default values on TypeScript 3.5 or higher
  • Unable to compile ts-sql-query with TypeScript 4.7
ts-sql-query - 1.28.0

Published by juanluispaz over 2 years ago

Changes:

  • Add compatibility mode to MySql to avoid use the with clause not supported by MySql 5
  • Add support to reference current value and value to insert in an insert on conflict do update
ts-sql-query - 1.27.0

Published by juanluispaz over 2 years ago

Re-release 1.27.0 due a mkdocs bug.

1.27.0 changes:

Documentation changes:

  • Add the insert on conflict methods to the supported operation documentation page

Bug fixes:

  • Fix TS4029 error when you need to emit the type definition (for use in a library) of the files that contains the database, tables and views
  • Avoid database connection leaks due a forbidden concurrent usage of a pooled query runner
Package Rankings
Top 5.15% on Npmjs.org
Badges
Extracted from project README
npm