-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
60f22ea
commit d226f4d
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
with | ||
usersJson := to_json('[ | ||
{ | ||
"name": "Bilbo", | ||
"pinnables": [ | ||
"Sindarin", | ||
"Quenya", | ||
"Dwarvish/Elvish Alliance", | ||
"Fellowship of Halfing Languages", | ||
"Emyn Muil", | ||
"Arnor Lake", | ||
"South Downs" | ||
] | ||
}, | ||
{ | ||
"name": "Peregrin", | ||
"pinnables": [ | ||
"English", | ||
"Sindarin", | ||
"Eriador Church", | ||
"The Rivendell Partnership", | ||
"Misty Mountains", | ||
"Lothlorien" | ||
] | ||
}, | ||
{ | ||
"name": "Aragorn", | ||
"pinnables": [ | ||
"Sindarin", | ||
"Eriador Church", | ||
"The Rivendell Partnership", | ||
"Emyn Muil", | ||
"Misty Mountains", | ||
"Lothlorien" | ||
] | ||
} | ||
]'), | ||
users := distinct ( | ||
for user in json_array_unpack(usersJson) | ||
union ( | ||
update User | ||
filter .realFirstName = <str>user['name'] | ||
set { | ||
pins += ( | ||
select Mixin::Pinnable | ||
filter [is Mixin::Named].name = <str>json_array_unpack(user['pinnables']) | ||
) | ||
} | ||
) | ||
), | ||
modified := (select users filter .modifiedAt = datetime_of_statement()) | ||
select {`Modified Users` := modified.realFirstName ++ ' ' ++ modified.realLastName} | ||
filter count(modified) > 0; |