graphprotocol / graphprotocol/graph-node
Allow where clause in subgraph queries to reference another field in type
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Rust
- Star
- 3.2k
- Fork
- 1.1k
- Merge trung bình
- 4 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 1
Mô tả
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;
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách lần theo cách các mệnh đề where của GraphQL subgraph được phân tích cú pháp và chuyển thành SQL; issue không nêu tên tệp triển khai hoặc test nào. Xác định cú pháp so sánh giữa các trường và xác định các lớp truy vấn và cơ sở dữ liệu cần hỗ trợ, sau đó bổ sung coverage cho việc so sánh stakedTokens với lockedTokens.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- graphql, rust, sql
- Lĩnh vực
- api, backend, databases
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100