Skip to content

v1.0.411

Choose a tag to compare

@ackava ackava released this 21 Apr 10:30

Full Changelog: v1.0.408...v1.0.411

Simple Join

You can join two tables only as a where clause. Selecting combined mapping will be released in future.

The following example shows how to join two tables with no relations and with on clause for like method.

const fp = db.filePermissions.where({ userID} , (p) => (x) => x.useID === p.userID);

q = db.files.innerJoin(fp, (fq) => (x) => Sql.text.startsWith(x.path, fq.path));

Union All

You can union multiple queries a single query for improved performance instead of using OR clause.

const ownedFiles = db.files.where({userID}, (p) => (x) => x.ownerID === p.userID);
const sharedFiles = db.files.where({userID}, (p) => (x) => x.fileShares.some((fs) => fs.ownerID === p.userID));

const allFiles = sharedFiles.unionAll(ownedFiles);