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

Method Octal

ext/formatting.go:398–409  ·  view source on GitHub ↗

Octal implements formatStringInterpolator.Octal.

(arg ref.Val, locale string)

Source from the content-addressed store, hash-verified

396
397// Octal implements formatStringInterpolator.Octal.
398func (c *stringFormatter) Octal(arg ref.Val, locale string) (string, error) {
399 switch arg.Type() {
400 case types.IntType:
401 argInt := arg.Value().(int64)
402 return fmt.Sprintf("%o", argInt), nil
403 case types.UintType:
404 argInt := arg.Value().(uint64)
405 return fmt.Sprintf("%o", argInt), nil
406 default:
407 return "", octalFormatError(runtimeID, arg.Type().TypeName())
408 }
409}
410
411// stringFormatValidator implements the cel.ASTValidator interface allowing for static validation
412// of string.format calls.

Callers

nothing calls this directly

Calls 4

octalFormatErrorFunction · 0.85
TypeMethod · 0.65
ValueMethod · 0.65
TypeNameMethod · 0.65

Tested by

no test coverage detected