Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a generic function for filtering any API request #1044

Open
lebogg opened this issue Mar 31, 2023 · 0 comments
Open

Use a generic function for filtering any API request #1044

lebogg opened this issue Mar 31, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@lebogg
Copy link
Member

lebogg commented Mar 31, 2023

Currently each API endpoint implementation doing some filtering, is implementing it on their on. See, e.g.,:

// Filtering the assessment results by
// * cloud service ID
// * compliant status
// * metric ID
if req.FilteredCloudServiceId != nil {
query = append(query, "cloud_service_id = ?")
args = append(args, req.GetFilteredCloudServiceId())
}
if req.FilteredCompliant != nil {
query = append(query, "compliant = ?")
args = append(args, req.GetFilteredCompliant())
}
if req.FilteredMetricId != nil {
query = append(query, "metric_id IN ?")
args = append(args, req.GetFilteredMetricId())
}

Try to use a more generic function that depending on the request and its filter fields, append the args and conds slices

@lebogg lebogg added the enhancement New feature or request label Mar 31, 2023
@lebogg lebogg self-assigned this Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant