MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / addObjectsToZip

Function addObjectsToZip

internal/cmd/plugin/report/output.go:129–143  ·  view source on GitHub ↗
(objects []namedObject, folder string, format plugin.OutputFormat, zipper *zip.Writer)

Source from the content-addressed store, hash-verified

127}
128
129func addObjectsToZip(objects []namedObject, folder string, format plugin.OutputFormat, zipper *zip.Writer) error {
130 for _, obj := range objects {
131 var objF io.Writer
132 fileName := filepath.Join(folder, obj.Name) + "." + string(format)
133 objF, err := zipper.Create(fileName)
134 if err != nil {
135 return fmt.Errorf("could not add object '%s' to zip: %w", obj, err)
136 }
137
138 if err = plugin.Print(obj.Object, format, objF); err != nil {
139 return fmt.Errorf("could not print '%s': %w", fileName, err)
140 }
141 }
142 return nil
143}

Callers 1

writeToZipMethod · 0.85

Calls 3

PrintFunction · 0.92
JoinMethod · 0.80
CreateMethod · 0.65

Tested by

no test coverage detected