Skip to content

Commit 7184cb0

Browse files
Update docs on IO methods (#1070)
1 parent da44524 commit 7184cb0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cel/io.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,14 @@ func AstToString(a *Ast) (string, error) {
102102
return parser.Unparse(a.impl.Expr(), a.impl.SourceInfo())
103103
}
104104

105-
// RefValueToValue converts between ref.Val and api.expr.Value.
105+
// RefValueToValue converts between ref.Val and google.api.expr.v1alpha1.Value.
106106
// The result Value is the serialized proto form. The ref.Val must not be error or unknown.
107107
func RefValueToValue(res ref.Val) (*exprpb.Value, error) {
108108
return ValueAsAlphaProto(res)
109109
}
110110

111+
// ValueAsAlphaProto converts between ref.Val and google.api.expr.v1alpha1.Value.
112+
// The result Value is the serialized proto form. The ref.Val must not be error or unknown.
111113
func ValueAsAlphaProto(res ref.Val) (*exprpb.Value, error) {
112114
canonical, err := ValueAsProto(res)
113115
if err != nil {
@@ -118,6 +120,8 @@ func ValueAsAlphaProto(res ref.Val) (*exprpb.Value, error) {
118120
return alpha, err
119121
}
120122

123+
// ValueAsProto converts between ref.Val and cel.expr.Value.
124+
// The result Value is the serialized proto form. The ref.Val must not be error or unknown.
121125
func ValueAsProto(res ref.Val) (*celpb.Value, error) {
122126
switch res.Type() {
123127
case types.BoolType:
@@ -205,11 +209,12 @@ var (
205209
anyPbType = reflect.TypeOf(&anypb.Any{})
206210
)
207211

208-
// ValueToRefValue converts between exprpb.Value and ref.Val.
212+
// ValueToRefValue converts between google.api.expr.v1alpha1.Value and ref.Val.
209213
func ValueToRefValue(adapter types.Adapter, v *exprpb.Value) (ref.Val, error) {
210214
return AlphaProtoAsValue(adapter, v)
211215
}
212216

217+
// AlphaProtoAsValue converts between google.api.expr.v1alpha1.Value and ref.Val.
213218
func AlphaProtoAsValue(adapter types.Adapter, v *exprpb.Value) (ref.Val, error) {
214219
canonical := &celpb.Value{}
215220
if err := convertProto(v, canonical); err != nil {
@@ -218,6 +223,7 @@ func AlphaProtoAsValue(adapter types.Adapter, v *exprpb.Value) (ref.Val, error)
218223
return ProtoAsValue(adapter, canonical)
219224
}
220225

226+
// ProtoAsValue converts between cel.expr.Value and ref.Val.
221227
func ProtoAsValue(adapter types.Adapter, v *celpb.Value) (ref.Val, error) {
222228
switch v.Kind.(type) {
223229
case *celpb.Value_NullValue:

0 commit comments

Comments
 (0)