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

Function adaptToV2

interpreter/interpretable.go:54–61  ·  view source on GitHub ↗

adaptToV2 adapts a V1 Interpretable implementation to the V2 interface. This adapter is used to bridge the legacy Interpretable interface to the modern InterpretableV2 interface, providing a shim that allows the use of both interfaces in the same system.

(i Interpretable)

Source from the content-addressed store, hash-verified

52// modern InterpretableV2 interface, providing a shim that allows the use of
53// both interfaces in the same system.
54func adaptToV2(i Interpretable) InterpretableV2 {
55 switch v := i.(type) {
56 case InterpretableV2:
57 return v
58 default:
59 return &v1Adapter{Interpretable: v}
60 }
61}
62
63// v1Adapter handles bridging a V1 Interpretable implementation to the V2 interface.
64type v1Adapter struct {

Callers 4

CustomDecoratorFunction · 0.85
TestV2AdapterFunction · 0.85
ConditionalAttributeMethod · 0.85
RelativeAttributeMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestV2AdapterFunction · 0.68