Skip to content

Releases: felixfbecker/node-sql-template-strings

v2.1.1

10 Aug 17:40
Compare
Choose a tag to compare

Fix TypeScript typings

Sequelize Support

10 Aug 17:39
Compare
Choose a tag to compare

Adds support for Sequelize raw queries via sequelize.query()

v2.0.0

03 May 16:43
Compare
Choose a tag to compare

I rewrote the project so that the tag function now returns an instance of SQLStatement. This has a method append() that allows to append another SQLStatement or a simple string to the statement to build complex queries.

const query = SQL`SELECT * FROM books`
if (params.name) {
  query.append(SQL` WHERE name = ${params.name}`)
}

You can also set the name of the query without Object.assign() through .setName().
I also updated the docs, rewrote the tests, added CI and TypeScript definitions.

Breaking Change

The append() method also allows to append raw values (like SQL.raw() did previously). I removed SQL.raw() because it would have complicated the implementation for keeping a duplicate, mostly unused feature. You can upgrade your code like this

db.query(SQL`SELECT * FROM ${SQL.raw(table)} WHERE name = ${name}`))
// becomes
db.query(SQL`SELECT * FROM `.append(table).append(SQL` WHERE name = ${name}`))

or simply stay at 1.x, no one will blame you :)

v1.1.1

16 Oct 09:12
Compare
Choose a tag to compare

Nothing but Readme updates

New SQL.raw() feature

29 Sep 02:15
Compare
Choose a tag to compare

You can now use SQL.raw() to insert values that should not get replaced by a placeholder.

v1.0.2

28 Sep 15:05
Compare
Choose a tag to compare
update README