MCPcopy Create free account
hub / github.com/cel-expr/cel-go / Octal

Method Octal

ext/formatting_v2.go:384–401  ·  view source on GitHub ↗

Octal implements formatStringInterpolatorV2.Octal.

(arg ref.Val)

Source from the content-addressed store, hash-verified

382
383// Octal implements formatStringInterpolatorV2.Octal.
384func (c *stringFormatterV2) Octal(arg ref.Val) (string, error) {
385 switch arg.Type() {
386 case types.IntType:
387 argInt, ok := arg.Value().(int64)
388 if !ok {
389 return "", fmt.Errorf("type conversion error from '%s' to '%s'", arg.Type(), types.IntType)
390 }
391 return strconv.FormatInt(argInt, 8), nil
392 case types.UintType:
393 argUint, ok := arg.Value().(uint64)
394 if !ok {
395 return "", fmt.Errorf("type conversion error from '%s' to '%s'", arg.Type(), types.UintType)
396 }
397 return strconv.FormatUint(argUint, 8), nil
398 default:
399 return "", octalFormatErrorV2(runtimeID, arg.Type().TypeName())
400 }
401}
402
403// stringFormatValidatorV2 implements the cel.ASTValidator interface allowing for static validation
404// of string.format calls.

Callers

nothing calls this directly

Calls 4

octalFormatErrorV2Function · 0.85
TypeMethod · 0.65
ValueMethod · 0.65
TypeNameMethod · 0.65

Tested by

no test coverage detected