fix(go): pass array as arg;

This commit is contained in:
VishalDalwadi
2026-04-02 22:34:23 +05:30
parent 85c1ecee35
commit bb7f640df4
+6 -3
View File
@@ -142,7 +142,7 @@ func handleListFlows(w http.ResponseWriter, r *http.Request) {
// 2. Source filters
if q.Get("src_type") != "" {
whereParts = append(whereParts, "src_type IN ?")
args = append(args, fmt.Sprintf("(%s)", strings.Join(q["src_type"], ",")))
args = append(args, q["src_type"])
}
srcEntity := q.Get("src_entity_id")
@@ -154,7 +154,7 @@ func handleListFlows(w http.ResponseWriter, r *http.Request) {
// 3. Destination filters
if q.Get("dst_type") != "" {
whereParts = append(whereParts, "dst_type IN ?")
args = append(args, fmt.Sprintf("(%s)", strings.Join(q["dst_type"], ",")))
args = append(args, q["dst_type"])
}
dstEntity := q.Get("dst_entity_id")
@@ -166,7 +166,7 @@ func handleListFlows(w http.ResponseWriter, r *http.Request) {
// 4. Protocol filter
if q.Get("protocol") != "" {
whereParts = append(whereParts, "protocol IN ?")
args = append(args, fmt.Sprintf("(%s)", strings.Join(q["protocol"], ",")))
args = append(args, q["protocol"])
}
// 5. Node filter
@@ -235,6 +235,9 @@ func handleListFlows(w http.ResponseWriter, r *http.Request) {
args = append(args, perPage, offset)
fmt.Println("QUERY:", query)
fmt.Println("ARGS:", args)
rows, err := conn.Query(r.Context(), query, args...)
if err != nil {
logic.ReturnErrorResponse(w, r,