Skip to content

Instantly share code, notes, and snippets.

@koskimas
Last active November 18, 2019 08:21
Show Gist options
  • Select an option

  • Save koskimas/e9b815d4587f09e3478e375347c837a9 to your computer and use it in GitHub Desktop.

Select an option

Save koskimas/e9b815d4587f09e3478e375347c837a9 to your computer and use it in GitHub Desktop.
await Person.query()
.withGraphFetched('children(isFemale, hasPets, isJennifer)')
.modifiers({
// New query-local modifier
hasPets(query: QueryBuilder<Person>): void {
query.whereExists(Person.relatedQuery('pets'))
},
// Bind argument to existing modifier.
isJennifer(query: QueryBuilder<Person>): void {
query.modify('findByName', 'Jennifer')
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment