11# Common Expression Language
22
3- [ ![ Go Report Card] ( https://goreportcard.com/badge/github.com/google /cel-go )] ( https://goreportcard.com/report/github.com/google /cel-go )
4- [ ![ GoDoc] ( https://godoc.org/github.com/google /cel-go?status.svg )] [ 6 ]
3+ [ ![ Go Report Card] ( https://goreportcard.com/badge/github.com/authzed /cel-go )] ( https://goreportcard.com/report/github.com/authzed /cel-go )
4+ [ ![ GoDoc] ( https://godoc.org/github.com/authzed /cel-go?status.svg )] [ 6 ]
55
66The Common Expression Language (CEL) is a non-Turing complete language designed
77for simplicity, speed, safety, and portability. CEL's C-like [ syntax] [ 1 ] looks
@@ -19,7 +19,7 @@ request.time - resource.age < duration("24h")
1919
2020``` typescript
2121// Check whether all resource names in a list match a given filter.
22- auth .claims .email_verified && resources .all (r , r .startsWith (auth .claims .email ))
22+ auth .claims .email_verified && resources .all (r , r .startsWith (auth .claims .email ));
2323```
2424
2525A CEL "program" is a single expression. The examples have been tagged as
@@ -35,16 +35,16 @@ A dashboard that shows results of cel-go conformance tests can be found
3535
3636---
3737
38- * [ Overview] ( #overview )
39- * [ Environment Setup] ( #environment-setup )
40- * [ Parse and Check] ( #parse-and-check )
41- * [ Macros] ( #macros )
42- * [ Evaluate] ( #evaluate )
43- * [ Errors] ( #Errors )
44- * [ Examples] ( examples/README.md )
45- * [ Install] ( #install )
46- * [ Common Questions] ( #common-questions )
47- * [ License] ( #license )
38+ - [ Overview] ( #overview )
39+ - [ Environment Setup] ( #environment-setup )
40+ - [ Parse and Check] ( #parse-and-check )
41+ - [ Macros] ( #macros )
42+ - [ Evaluate] ( #evaluate )
43+ - [ Errors] ( #Errors )
44+ - [ Examples] ( examples/README.md )
45+ - [ Install] ( #install )
46+ - [ Common Questions] ( #common-questions )
47+ - [ License] ( #license )
4848
4949---
5050
@@ -56,11 +56,11 @@ against some input. Checking is optional, but strongly encouraged.
5656
5757### Environment Setup
5858
59- Let's expose ` name ` and ` group ` variables to CEL using the ` cel.Declarations `
59+ Let's expose ` name ` and ` group ` variables to CEL using the ` cel.Declarations `
6060environment option:
6161
6262``` go
63- import " github.com/google /cel-go/cel"
63+ import " github.com/authzed /cel-go/cel"
6464
6565env , err := cel.NewEnv (
6666 cel.Variable (" name" , cel.StringType ),
@@ -116,7 +116,7 @@ list and map values.
116116
117117``` javascript
118118// Ensure all tweets are less than 140 chars
119- tweets .all (t, t .size () <= 140 )
119+ tweets .all (t, t .size () <= 140 );
120120```
121121
122122The ` has ` macro is useful for unifying field presence testing logic across
@@ -125,7 +125,7 @@ protobuf types and dynamic (JSON-like) types.
125125``` javascript
126126// Test whether the field is a non-default value if proto-based, or defined
127127// in the JSON case.
128- has (message .field )
128+ has (message .field );
129129```
130130
131131Both cases traditionally require special syntax at the language level, but
@@ -170,22 +170,22 @@ unknown values, with the `?` indicating that the branch is not taken due to
170170short-circuiting. When the result is ` <x, y> ` this means that the both args
171171are possibly relevant to the result.
172172
173- | Expression | Result |
174- | --------------------- | ---------- |
175- | ` false && ? ` | ` false ` |
176- | ` true && false ` | ` false ` |
177- | ` <x> && false ` | ` false ` |
178- | ` true && true ` | ` true ` |
179- | ` true && <x> ` | ` <x> ` |
180- | ` <x> && true ` | ` <x> ` |
181- | ` <x> && <y> ` | ` <x, y> ` |
182- | ` true \|\| ? ` | ` true ` |
183- | ` false \|\| true ` | ` true ` |
184- | ` <x> \|\| true ` | ` true ` |
185- | ` false \|\| false ` | ` false ` |
186- | ` false \|\| <x> ` | ` <x> ` |
187- | ` <x> \|\| false ` | ` <x> ` |
188- | ` <x> \|\| <y> ` | ` <x, y> ` |
173+ | Expression | Result |
174+ | ------------------ | -------- |
175+ | ` false && ? ` | ` false ` |
176+ | ` true && false ` | ` false ` |
177+ | ` <x> && false ` | ` false ` |
178+ | ` true && true ` | ` true ` |
179+ | ` true && <x> ` | ` <x> ` |
180+ | ` <x> && true ` | ` <x> ` |
181+ | ` <x> && <y> ` | ` <x, y> ` |
182+ | ` true \|\| ? ` | ` true ` |
183+ | ` false \|\| true ` | ` true ` |
184+ | ` <x> \|\| true ` | ` true ` |
185+ | ` false \|\| false ` | ` false ` |
186+ | ` false \|\| <x> ` | ` <x> ` |
187+ | ` <x> \|\| false ` | ` <x> ` |
188+ | ` <x> \|\| <y> ` | ` <x, y> ` |
189189
190190In the cases where unknowns are expected, ` cel.EvalOptions(cel.OptTrackState) `
191191should be enabled. The ` details ` value returned by ` Eval() ` will contain the
@@ -253,19 +253,19 @@ runtime bindings and error handling to do the right thing.
253253
254254# ## Where can I learn more about the language?
255255
256- * See the [CEL Spec][1] for the specification and conformance test suite.
257- * Ask for support on the [CEL Go Discuss][2] Google group.
256+ - See the [CEL Spec][1] for the specification and conformance test suite.
257+ - Ask for support on the [CEL Go Discuss][2] Google group.
258258
259259# ## Where can I learn more about the internals?
260260
261- * See [GoDoc][6] to learn how to integrate CEL into services written in Go.
262- * See the [CEL C++][3] toolchain (under development) for information about how
261+ - See [GoDoc][6] to learn how to integrate CEL into services written in Go.
262+ - See the [CEL C++][3] toolchain (under development) for information about how
263263 to integrate CEL evaluation into other environments.
264264
265265# ## How can I contribute?
266266
267- * See [CONTRIBUTING.md](./CONTRIBUTING.md) to get started.
268- * Use [GitHub Issues][4] to request features or report bugs.
267+ - See [CONTRIBUTING.md](./CONTRIBUTING.md) to get started.
268+ - Use [GitHub Issues][4] to request features or report bugs.
269269
270270# ## Some tests don't work with `go test`?
271271
@@ -283,9 +283,9 @@ Released under the [Apache License](LICENSE).
283283
284284Disclaimer: This is not an official Google product.
285285
286- [1]: https://github.com/google/cel-spec
287- [2]: https://groups.google.com/forum/#! forum/cel-go-discuss
288- [3]: https://github.com/google/cel-cpp
289- [4]: https://github.com/google /cel-go/issues
290- [5]: https://bazel.build
291- [6]: https://godoc.org/github.com/google /cel-go
286+ [1]: https://github.com/google/cel-spec
287+ [2]: https://groups.google.com/forum/#! forum/cel-go-discuss
288+ [3]: https://github.com/google/cel-cpp
289+ [4]: https://github.com/authzed /cel-go/issues
290+ [5]: https://bazel.build
291+ [6]: https://godoc.org/github.com/authzed /cel-go
0 commit comments