query {
items(where: {
team: {
key: {_eq: "ENG" }
}
_or: [
{ status: { _eq: "BLOCKED" } }
{ flagged: { _eq: true } }
]
}, sort_by: { dueDate: DESC },
limit: 10) {
id
title
}
}
I love that GraphQL can represent almost anything, but it becomes so verbose. Sure, you can put all the where logic on one line, as long as you doing mind staring at { { { ... } } }.
I'm thinking of a more condensed version. Something like:
//
where order by limit
select items (team.key = "ENG", > dueDate, 100) {
id
title
author (id = 123) {
id
name
}
}
It takes a little time to get used to not having "WHERE", "ORDER BY", and "LIMIT", but personally I can read that faster now that I've seen it for a few minutes. Select and update queries could mirror each other. It would need to support UPSERTs and a few other common features.
update items (id = 456) {
flagged = true
}
create items (id, title) { // (returned fields) for create
title = "Do it"
}
Aggregate queries:
select items (team.key = "ENG") {
count status
max points
}
Nested create queries:
create author (id, name) {
books = [
create books (id, title) { title = "Do it" }
insert books () { id = 123 }
]
}
Subqueries:
create item (id, title) {
title = "Do it"
seq_id = update team (id = "ENG") { next_seq_id += 1 }
}
Not completely though through, just an idea.