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

Method CompileOptions

ext/math.go:415–597  ·  view source on GitHub ↗

CompileOptions implements the Library interface method.

()

Source from the content-addressed store, hash-verified

413
414// CompileOptions implements the Library interface method.
415func (lib *mathLib) CompileOptions() []cel.EnvOption {
416 opts := []cel.EnvOption{
417 cel.Macros(
418 // math.least(num, ...)
419 cel.ReceiverVarArgMacro(leastMacro, mathLeast),
420 // math.greatest(num, ...)
421 cel.ReceiverVarArgMacro(greatestMacro, mathGreatest),
422 ),
423 cel.Function(minFunc,
424 cel.Overload("math_@min_double", []*cel.Type{cel.DoubleType}, cel.DoubleType,
425 cel.UnaryBinding(identity)),
426 cel.Overload("math_@min_int", []*cel.Type{cel.IntType}, cel.IntType,
427 cel.UnaryBinding(identity)),
428 cel.Overload("math_@min_uint", []*cel.Type{cel.UintType}, cel.UintType,
429 cel.UnaryBinding(identity)),
430 cel.Overload("math_@min_double_double", []*cel.Type{cel.DoubleType, cel.DoubleType}, cel.DoubleType,
431 cel.BinaryBinding(minPair)),
432 cel.Overload("math_@min_int_int", []*cel.Type{cel.IntType, cel.IntType}, cel.IntType,
433 cel.BinaryBinding(minPair)),
434 cel.Overload("math_@min_uint_uint", []*cel.Type{cel.UintType, cel.UintType}, cel.UintType,
435 cel.BinaryBinding(minPair)),
436 cel.Overload("math_@min_int_uint", []*cel.Type{cel.IntType, cel.UintType}, cel.DynType,
437 cel.BinaryBinding(minPair)),
438 cel.Overload("math_@min_int_double", []*cel.Type{cel.IntType, cel.DoubleType}, cel.DynType,
439 cel.BinaryBinding(minPair)),
440 cel.Overload("math_@min_double_int", []*cel.Type{cel.DoubleType, cel.IntType}, cel.DynType,
441 cel.BinaryBinding(minPair)),
442 cel.Overload("math_@min_double_uint", []*cel.Type{cel.DoubleType, cel.UintType}, cel.DynType,
443 cel.BinaryBinding(minPair)),
444 cel.Overload("math_@min_uint_int", []*cel.Type{cel.UintType, cel.IntType}, cel.DynType,
445 cel.BinaryBinding(minPair)),
446 cel.Overload("math_@min_uint_double", []*cel.Type{cel.UintType, cel.DoubleType}, cel.DynType,
447 cel.BinaryBinding(minPair)),
448 cel.Overload("math_@min_list_double", []*cel.Type{cel.ListType(cel.DoubleType)}, cel.DoubleType,
449 cel.UnaryBinding(minList)),
450 cel.Overload("math_@min_list_int", []*cel.Type{cel.ListType(cel.IntType)}, cel.IntType,
451 cel.UnaryBinding(minList)),
452 cel.Overload("math_@min_list_uint", []*cel.Type{cel.ListType(cel.UintType)}, cel.UintType,
453 cel.UnaryBinding(minList)),
454 ),
455 cel.Function(maxFunc,
456 cel.Overload("math_@max_double", []*cel.Type{cel.DoubleType}, cel.DoubleType,
457 cel.UnaryBinding(identity)),
458 cel.Overload("math_@max_int", []*cel.Type{cel.IntType}, cel.IntType,
459 cel.UnaryBinding(identity)),
460 cel.Overload("math_@max_uint", []*cel.Type{cel.UintType}, cel.UintType,
461 cel.UnaryBinding(identity)),
462 cel.Overload("math_@max_double_double", []*cel.Type{cel.DoubleType, cel.DoubleType}, cel.DoubleType,
463 cel.BinaryBinding(maxPair)),
464 cel.Overload("math_@max_int_int", []*cel.Type{cel.IntType, cel.IntType}, cel.IntType,
465 cel.BinaryBinding(maxPair)),
466 cel.Overload("math_@max_uint_uint", []*cel.Type{cel.UintType, cel.UintType}, cel.UintType,
467 cel.BinaryBinding(maxPair)),
468 cel.Overload("math_@max_int_uint", []*cel.Type{cel.IntType, cel.UintType}, cel.DynType,
469 cel.BinaryBinding(maxPair)),
470 cel.Overload("math_@max_int_double", []*cel.Type{cel.IntType, cel.DoubleType}, cel.DynType,
471 cel.BinaryBinding(maxPair)),
472 cel.Overload("math_@max_double_int", []*cel.Type{cel.DoubleType, cel.IntType}, cel.DynType,

Callers

nothing calls this directly

Calls 8

MacrosFunction · 0.92
ReceiverVarArgMacroFunction · 0.92
FunctionFunction · 0.92
OverloadFunction · 0.92
UnaryBindingFunction · 0.92
BinaryBindingFunction · 0.92
CostModelFunction · 0.92
mathListCostModelFunction · 0.85

Tested by

no test coverage detected