Feature: supporting optional arguments in named/favourite queries?
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Bắt đầu bằng cách lần theo cách xử lý hiện có của \n NAME ARGS... đối với các truy vấn được đặt tên và truy vấn yêu thích trong pgspecial. Xác định cú pháp đối số tùy chọn và hành vi khi thiếu giá trị, bao gồm cả các tham số được tổng hợp, sau đó bổ sung phạm vi kiểm thử cho các lần gọi có và không có đối số tùy chọn, đồng thời giữ nguyên các lỗi hiện có đối với đối số bắt buộc.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hopefully this is the right place, since as best I can tell, the code for \n NAME ARGS... as provided by pgcli actually lives in here.
It would be convenient if there was a way to specify optional arguments to be replaced in a named query, to allow something like:
\ns opt-args select * from some_table where ($?1 is null or some_field like '%$?1%')
so it could be invoked as either \n opt-args with no args to just query everything, or if \n opt-args somevalue to filter to only things matching that argument, without needing to have different queries with/without args (and remembering which you want to use at the time)
I've invented the $?<num> format in the above example which doesn't currently exist. That allows it to be distinguished from normal arguments as they are now, to avoid breaking existing behaviour of the invocation failing if there are unreplaced parameters left.
I'm currently imagining that the optional arg would just be substituted with the value NULL if not present, although a case could be made for a more bash-like ${VAR:-DEFAULT} to allow arbitrary replacement values if not provided.
It might make sense to allow optional aggregated params as well, although not sure if they should expand to an empty list, or also to NULL.
I think I can probably cobble up a PR if there's any interest, but figured it might be wise to check first, and maybe bikeshed the syntax before ploughing ahead 😄
- Ngôn ngữ chính
- Python
- Star
- 86
- Fork
- 54
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc 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.
Issue khác của dbcli/pgspecial
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 40/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Add \crosstabviewĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
Tất cả issue của dbcli/pgspecial
Issue tương tự
-
Use mhctools predictor_required=False for saved-result rescoringCó thể đã có người làm @iskandr đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
521xueweihan/HelloGitHub#4051 · 1 bình luận ·
-
bug documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
awslabs/visual-asset-management-system#514 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend bug spec:REQ-053
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
nolte/kamerplanter#2547 ·
Maintainer thường phản hồi trong vòng 1 ngày