MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / extractCSVColumn

Function extractCSVColumn

app/cli/pkg/action/policy_input_file.go:147–159  ·  view source on GitHub ↗
(content []byte, column string)

Source from the content-addressed store, hash-verified

145}
146
147func extractCSVColumn(content []byte, column string) ([]string, error) {
148 table, err := tabular.Parse(content)
149 if err != nil {
150 return nil, fmt.Errorf("parsing CSV policy input file: %w", err)
151 }
152
153 values, ok := table.Column(column)
154 if !ok {
155 return nil, fmt.Errorf("column %q not found in CSV header %v", column, table.Header)
156 }
157
158 return values, nil
159}
160
161// extractJSONColumn extracts column values from one of three accepted shapes:
162// a bare array of strings, an array of string-valued objects (the column field

Callers 1

ExtractColumnValuesFunction · 0.85

Calls 2

ParseFunction · 0.92
ColumnMethod · 0.80

Tested by

no test coverage detected