Last active
April 11, 2019 17:58
-
-
Save roboncode/09fbc3c117c4d180d9dbb3490c97f7bb to your computer and use it in GitHub Desktop.
Orango - Complex Queries Concepts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { append } = orango.funcs | |
orango.builder() | |
.add('numbers', append([1, 2, 3], [3, 4, 5], true)) | |
.add('email', '[email protected]') | |
.add('users', User.find().where({email: "@email"}) | |
.return({ | |
}) | |
/* | |
LET ACTIVE = true | |
LET usrs = ( | |
FOR u IN users | |
FILTER u.active == ACTIVE | |
UPDATE u WITH { message: "Hello, world!" } IN users | |
RETURN NEW | |
) | |
FOR u IN usrs | |
RETURN u | |
*/ | |
const { extract } from orango.consts | |
orango | |
.commands() | |
.add('ACTIVE', false) | |
.add('usrs', User.find().where({ active: '${ACTIVE}' }).subquery(User.update().with({ message: "Hello, world!" }))) | |
.add('updated_users', User.find().name('usrs')) | |
.return(extract('${updated_users}', 'firstName', 'lastName')) |
Author
roboncode
commented
Apr 11, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment