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

Function addContentToZip

internal/cmd/plugin/report/output.go:115–127  ·  view source on GitHub ↗
(c interface{}, name, folder string, format plugin.OutputFormat, zipper *zip.Writer)

Source from the content-addressed store, hash-verified

113}
114
115func addContentToZip(c interface{}, name, folder string, format plugin.OutputFormat, zipper *zip.Writer) error {
116 var writer io.Writer
117 fileName := filepath.Join(folder, name) + "." + string(format)
118 writer, err := zipper.Create(fileName)
119 if err != nil {
120 return fmt.Errorf("could not add '%s' to zip: %w", fileName, err)
121 }
122
123 if err = plugin.Print(c, format, writer); err != nil {
124 return fmt.Errorf("could not print '%s': %w", fileName, err)
125 }
126 return nil
127}
128
129func addObjectsToZip(objects []namedObject, folder string, format plugin.OutputFormat, zipper *zip.Writer) error {
130 for _, obj := range objects {

Callers 3

writeToZipMethod · 0.85
writeToZipMethod · 0.85
writeToZipMethod · 0.85

Calls 3

PrintFunction · 0.92
JoinMethod · 0.80
CreateMethod · 0.65

Tested by

no test coverage detected