fix init users and naive #553

This commit is contained in:
Alireza Ahmadi
2025-05-04 23:38:42 +02:00
parent a10950499b
commit 0a08e9f834
+5 -2
View File
@@ -245,8 +245,11 @@ func (s *InboundService) fetchUsers(db *gorm.DB, inboundType string, condition s
}
var users []string
err := db.Raw(`SELECT json_extract(clients.config, ?) FROM clients WHERE enable = true AND ?`,
"$."+inboundType, condition).Scan(&users).Error
err := db.Raw(
fmt.Sprintf(`SELECT json_extract(clients.config, "$.%s")
FROM clients WHERE enable = true AND %s`,
inboundType, condition)).Scan(&users).Error
if err != nil {
return nil, err
}