graphprotocol / graphprotocol/graph-node
Allow where clause in subgraph queries to reference another field in type
Nessuno ha ancora preso questa issue.
- Lingua principale
- Rust
- Stelle
- 3.2k
- Fork
- 1.1k
- Merge medio
- 4g 1h
- PR unite (30g)
- 1
Descrizione
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
Currently, the where clause in a subgraph query only allows you to pass values to it that are of the type of the field being filtered against.
ex:
query Indexers {
indexers(where: { stakedTokens: 0 }) {
id
stakedTokens
lockedTokens
}
}
Where: stakedTokens is of type BigInt and the value passed (0 in the example) must also be a BigInt.
What is the expected behavior?
It would be very helpful if the where clause was able to compare two fields against each other to filter results.
ex:
query Indexers {
indexers(where: { stakedTokens: {indexer? me? this?}.lockedTokens }) {
id
stakedTokens
lockedTokens
}
}
Mapping down to sql, this would look (something like):
SELECT id, staked_tokens, locked_tokens FROM indexer WHERE staked_tokens = locked_tokens;
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia tracciando come vengono analizzate e tradotte in SQL le clausole where dei subgraph GraphQL; l’issue non indica file di implementazione né test. Definisci la sintassi per il confronto tra campi e individua i livelli di query e di database che dovrebbero supportarla, quindi aggiungi la copertura per il confronto di stakedTokens con lockedTokens.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- graphql, rust, sql
- Ambito
- api, backend, databases
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100