Files
steampipe/pkg/steampipeconfig/modconfig/mod_validate.go
kaidaguerre 404dd35e21 Update database code to use pgx interface so we can leverage the connection pool hook functions to pre-warm connections. Closes #2422 (#2438)
* Provide feedback for failed prepared statements
* Move error functions to error_helpers
* Make maintenance client retriable
2022-10-05 12:38:57 +01:00

32 lines
744 B
Go

package modconfig
import (
"fmt"
"github.com/turbot/steampipe/pkg/error_helpers"
)
// ensure we have resolved all children in the resource tree
func (m *Mod) validateResourceTree() error {
var errors []error
for _, child := range m.GetChildren() {
if err := m.validateChildren(child); err != nil {
errors = append(errors, err)
}
}
return error_helpers.CombineErrorsWithPrefix(fmt.Sprintf("failed to resolve children for %d resources", len(errors)), errors...)
}
func (m *Mod) validateChildren(item ModTreeItem) error {
missing := 0
for _, child := range item.GetChildren() {
if child == nil {
missing++
}
}
if missing > 0 {
return fmt.Errorf("%s has %d unresolved children", item.Name(), missing)
}
return nil
}