SurrealDB SDK for JavaScript
Full Changelog: https://github.com/surrealdb/surrealdb.js/compare/v1.0.0-beta.7...v1.0.0-beta.8
run
and relate
method by @kearfy in https://github.com/surrealdb/surrealdb.js/pull/264
Full Changelog: https://github.com/surrealdb/surrealdb.js/compare/v1.0.0-beta.6...v1.0.0-beta.7
toJSON
and StringRecordId
by @kearfy in https://github.com/surrealdb/surrealdb.js/pull/256
jsonify()
method by @kearfy in https://github.com/surrealdb/surrealdb.js/pull/259
Full Changelog: https://github.com/surrealdb/surrealdb.js/compare/v1.0.0-beta.5...v1.0.0-beta.6
Full Changelog: https://github.com/surrealdb/surrealdb.js/compare/v1.0.0-beta.4...v1.0.0-beta.5
Full Changelog: https://github.com/surrealdb/surrealdb.js/compare/v1.0.0-beta.3...v1.0.0-beta.4
Full Changelog: https://github.com/surrealdb/surrealdb.js/compare/v1.0.0-beta.2...v1.0.0-beta.3
Full Changelog: https://github.com/surrealdb/surrealdb.js/compare/v1.0.0-beta.1...v1.0.0-beta.2
Full Changelog: https://github.com/surrealdb/surrealdb.js/compare/v0.11.1...v1.0.0-beta.1
surrealql()
by @oliver-oloughlin in https://github.com/surrealdb/surrealdb.js/pull/222
Full Changelog: https://github.com/surrealdb/surrealdb.js/compare/v0.11.0...v0.11.1
.query()
methodTo 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"
PreparedQuery
class which can be passed to the .query()
and .query_raw()
methods.surrealql
(and surql
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}`
);
Full Changelog: https://github.com/surrealdb/surrealdb.js/compare/v0.10.1...v0.11.0