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

Method Call

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

Source from the content-addressed store, hash-verified

12}
13
14func (b *Base64) Call(args []super.Value) super.Value {
15 val := args[0].Under()
16 if val.IsNull() {
17 return super.Null
18 }
19 switch val.Type().ID() {
20 case super.IDBytes:
21 return super.NewString(base64.StdEncoding.EncodeToString(val.Bytes()))
22 case super.IDString:
23 bytes, err := base64.StdEncoding.DecodeString(super.DecodeString(val.Bytes()))
24 if err != nil {
25 return b.sctx.WrapError("base64: string argument is not base64", val)
26 }
27 return super.NewBytes(bytes)
28 default:
29 return b.sctx.WrapError("base64: argument must a bytes or string type", val)
30 }
31}
32
33type Hex struct {
34 sctx *super.Context

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