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

Method CompileOptions

ext/math.go:417–598  ·  view source on GitHub ↗

CompileOptions implements the Library interface method.

()

Source from the content-addressed store, hash-verified

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

Tested by

no test coverage detected