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

Method Call

runtime/sam/expr/function/bytes.go:37–54  ·  view source on GitHub ↗
(args []super.Value)

Source from the content-addressed store, hash-verified

35}
36
37func (h *Hex) Call(args []super.Value) super.Value {
38 val := args[0].Under()
39 if val.IsNull() {
40 return super.Null
41 }
42 switch val.Type().ID() {
43 case super.IDBytes:
44 return super.NewString(hex.EncodeToString(val.Bytes()))
45 case super.IDString:
46 b, err := hex.DecodeString(super.DecodeString(val.Bytes()))
47 if err != nil {
48 return h.sctx.WrapError("hex: string argument is not hexidecimal", val)
49 }
50 return super.NewBytes(b)
51 default:
52 return h.sctx.WrapError("base64: argument must a bytes or string type", val)
53 }
54}

Callers

nothing calls this directly

Calls 9

NewStringFunction · 0.92
DecodeStringFunction · 0.92
NewBytesFunction · 0.92
UnderMethod · 0.80
IsNullMethod · 0.80
WrapErrorMethod · 0.80
IDMethod · 0.65
TypeMethod · 0.65
BytesMethod · 0.45

Tested by

no test coverage detected