MCPcopy Create free account
hub / github.com/brimdata/super / decodeStrings

Function decodeStrings

compiler/semantic/op.go:387–403  ·  view source on GitHub ↗
(val *super.Value)

Source from the content-addressed store, hash-verified

385}
386
387func decodeStrings(val *super.Value) ([]string, error) {
388 typ := super.TypeUnder(val.Type())
389 if inner := super.InnerType(typ); inner != nil {
390 if inner.ID() != super.IDString {
391 return nil, errors.New("array elements of header field must be strings")
392 }
393 var out []string
394 for it := val.ContainerIter(); !it.Done(); {
395 out = append(out, super.DecodeString(it.Next()))
396 }
397 return out, nil
398 }
399 if typ != super.TypeString {
400 return nil, errors.New("header field value must be a string or an array or set of strings")
401 }
402 return []string{val.AsString()}, nil
403}
404
405func (t *translator) fromPoolRegexp(node ast.Node, re, orig, which string, args []ast.OpArg) sem.Seq {
406 poolNames, err := t.matchPools(re, orig, which)

Callers 1

unmarshalHeadersFunction · 0.85

Calls 10

TypeUnderFunction · 0.92
InnerTypeFunction · 0.92
DecodeStringFunction · 0.92
NewMethod · 0.80
ContainerIterMethod · 0.80
AsStringMethod · 0.80
TypeMethod · 0.65
IDMethod · 0.65
DoneMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected