Release v0.11.0
Overview
Simplified .query()
method
To further align our JS landscape, the current .query()
method is renamed to .query_raw()
, and a new and simplified .query()
method is introduced. This new method either throws an error or gives back an array of response values.
await db.query<boolean, number>(`true; 123`);
// [true, 123]
// This would previously be an array with query response objects, containing the result.
await db.query(`THROW "some error"`);
// Throws: "An error occurred: some error"
Tagged template literals
- We now expose a
PreparedQuery
class which can be passed to the.query()
and.query_raw()
methods. - We now expose a
surrealql
(andsurql
as a shortcut) function which can be used as a tagged template literal.
const name = "John Doe";
const age = 44;
// With PreparedQuery
const query = new PreparedQuery(
/* surql */`RETURN $name; RETURN $age`,
{ name, age }
);
const prepared = await db.query(query);
// With a tagged template literal
const templated = await db.query(
surrealql`RETURN ${name}; RETURN ${age}`
);
What's Changed
- Update README.md to address namespace and database naming changes by @Nipodemos in #188
- Simplified query method by @kearfy in #189
- Tagged template literals by @kearfy in #190
- Improved auth tests by @kearfy in #191
- Bump v0.11.0 by @kearfy in #192
New Contributors
- @Nipodemos made their first contribution in #188
Full Changelog: v0.10.1...v0.11.0