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

Method CompileOptions

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

CompileOptions implements the Library interface method.

()

Source from the content-addressed store, hash-verified

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