Created
December 9, 2020 18:08
-
-
Save ORBAT/9cc2bce522584ec45719d74ea969d628 to your computer and use it in GitHub Desktop.
Sketch of graph search API for ent
This file contains hidden or 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
// Find all the supervisors (and their supervisors, | |
// and their supervisors and so on) of someUser | |
// who work in billing. | |
// | |
// someUser is the base case of WITH RECURSIVE | |
someUser.SearchSupervisors(). | |
Where(user.OrganizationalUnit("billing")). | |
// no duplicates in the result (UNION ALL) and the | |
// search will terminate even if there are cycles | |
// in the graph | |
NoDuplicates(). | |
AllX(ctx) | |
// Find all users in Finland who have subordinates, | |
// then find all their subordinates (and their | |
// subordinates etc etc) in Finland and who work | |
// in R&D. | |
// | |
// Base case is multiple users. Note that base case | |
// results will be included in the final result | |
client.User.Query(). | |
Where(user.Country("fi"), user.HasSubordinates()). | |
SearchSubordinates(). | |
Where(user.Country("fi"), | |
user.OrganizationalUnit("r&d")). | |
NoDuplicates(). | |
AllX(ctx) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment