কমন এক্সপ্রেশন ল্যাঙ্গুয়েজ (CEL) এপিআই রেফারেন্স

এই ডকুমেন্টটি কমন এক্সপ্রেশন ল্যাঙ্গুয়েজ (CEL)-এর জন্য একটি সমন্বিত এপিআই ডক রেফারেন্স হিসেবে কাজ করে। এতে অফিসিয়াল CEL স্ট্যাক জুড়ে সমস্ত ম্যাক্রো, অপারেটর এবং স্ট্যান্ডার্ড ফাংশনগুলোর সিগনেচার, আচরণ এবং সাপোর্ট স্ট্যাটাস উল্লেখ করা হয়েছে।

ভাষার আচরণ ও নির্দিষ্টকরণ সম্পর্কে আরও বিশদ তথ্যের জন্য, CEL ভাষার সংজ্ঞা দেখুন।

স্ট্যাক সংস্করণ

এই রেফারেন্স ডকুমেন্টটি CEL স্ট্যাকের নিম্নলিখিত সংস্করণগুলির উপর ভিত্তি করে তৈরি:

  • CEL Go : v0.32.0 (এবং নতুন সংস্করণ)
  • সেল সি++ : v0.16.1
  • সিইএল জাভা : v0.14.0
  • CEL পাইথন : v0.1.3
  • সিইএল সি : উন্নয়ন স্ন্যাপশট (অপ্রকাশিত)

গিটহাব মিরর

CEL-এর আনুষ্ঠানিক বাস্তবায়নগুলো গিটহাবে cel-expr অর্গানাইজেশনের অধীনে মিরর করা আছে:


১. মূল ম্যাক্রো

এগুলো হলো অন্তর্নির্মিত ম্যাক্রো যা কম্পাইল করার সময় সম্প্রসারিত হয়।

ম্যাক্রো বর্ণনা যান সি++ জাভা পাইথন সি
has(container.field) কোনো মেসেজে একটি ফিল্ড, অথবা একটি ম্যাপের কোনো কী উপস্থিত আছে কিনা তা পরীক্ষা করে।

স্বাক্ষরসমূহ:
has(container.field) -> bool

উদাহরণ:
has(request.auth.claims.email)
list.all(var, predicate) একটি তালিকার সমস্ত উপাদান একটি শর্ত পূরণ করে কিনা তা পরীক্ষা করে।

স্বাক্ষরসমূহ:
list.all(var, predicate) -> bool

উদাহরণ:
[1, 2, 3].all(x, x > 0) // true
¹
list.exists(var, predicate) একটি তালিকার অন্তত একটি উপাদান কোনো শর্ত পূরণ করে কি না, তা পরীক্ষা করে।

স্বাক্ষরসমূহ:
list.exists(var, predicate) -> bool

উদাহরণ:
[1, 2, 3].exists(x, x > 2) // true
¹
list.exists_one(var, predicate) একটি তালিকার ঠিক একটি উপাদান কোনো শর্ত পূরণ করে কি না, তা পরীক্ষা করে।

স্বাক্ষরসমূহ:
list.exists_one(var, predicate) -> bool

উদাহরণ:
[1, 2, 3].exists_one(x, x == 2) // true
¹
list.filter(var, predicate) একটি প্রেডিকেট অনুসারে তালিকার উপাদানগুলোকে ফিল্টার করে।

স্বাক্ষরসমূহ:
list.filter(var, predicate) -> list

উদাহরণ:
[1, 2, 3].filter(x, x > 1) // [2, 3]
¹
list.map(var, transform) একটি এক্সপ্রেশন ব্যবহার করে তালিকার প্রতিটি উপাদানকে রূপান্তরিত করে।

স্বাক্ষরসমূহ:
list.map(var, transform) -> list

উদাহরণ:
[1, 2, 3].map(x, x * 2) // [2, 4, 6]
¹
list.map(var, filter, transform) তালিকার সেই উপাদানগুলোকে রূপান্তরিত করে যেগুলো একটি ফিল্টার প্রেডিকেট পূরণ করে।

স্বাক্ষরসমূহ:
list.map(var, filter, transform) -> list

উদাহরণ:
[1, 2, 3].map(x, x > 1, x * 2) // [4, 6]
¹

¹ সি রানটাইমে সমর্থিত, কারণ হোস্ট কম্পাইলার দ্বারা কম্পাইলেশনের সময় ম্যাক্রোগুলো কম্প্রিহেনশনে প্রসারিত হয়।


২. মূল অপারেটররা

অপারেটর বর্ণনা যান সি++ জাভা পাইথন সি
পাটিগণিত ( + , - , * , / , % ) সাধারণ গাণিতিক প্রক্রিয়া। নেগেশন ( -x ) এবং আইডেন্টিটি ( +x )। লিস্ট কনক্যাটেনেশন ( list + list ) Go, C++, Java, এবং Python-এ সমর্থিত।

স্বাক্ষরসমূহ:
T + T -> T
T - T -> T
T * T -> T
T / T -> T
T % T -> T
-T -> T
+T -> T
list + list -> list

উদাহরণ:
1 + 2 * 3 // 7
[1] + [2] // [1, 2]
²
তুলনা ( == , != , < , <= , > , >= ) সাধারণ তুলনা। সংখ্যাসূচক তুলনাগুলো ভিন্নধর্মী হয় (যেমন 1 == 1.0 )।

স্বাক্ষরসমূহ:
T == T -> bool
T != T -> bool
T < T -> bool
T <= T -> bool
T > T -> bool
T >= T -> bool

উদাহরণ:
x < 42.0
1 == 1.0 // true
যৌক্তিক ( ! , && , || , ? : :) লজিক্যাল NOT, AND, OR, এবং টারনারি কন্ডিশনাল। AND/OR শর্ট-সার্কিট ইভ্যালুয়েশন ব্যবহার করে।

স্বাক্ষরসমূহ:
!bool -> bool
bool && bool -> bool
bool || bool -> bool
bool ? T : T -> T

উদাহরণ:
x > 0 ? "positive" : "non-positive"
সূচীকরণ ( [] ) ইনডেক্স ব্যবহার করে লিস্টের এলিমেন্ট অ্যাক্সেস করুন, অথবা ম্যাপে লুকআপ কী ব্যবহার করুন।

স্বাক্ষরসমূহ:
list[int] -> T
map[K] -> V

উদাহরণ:
tags[0]
users['john']
সদস্যপদ ( in ) এলিমেন্টটি কোনো লিস্টে আছে কিনা, অথবা কী-টি কোনো ম্যাপে আছে কিনা তা যাচাই করুন।

স্বাক্ষরসমূহ:
T in list -> bool
K in map -> bool

উদাহরণ:
'admin' in roles

² সি রানটাইমে লিস্ট সংযোজন ( list + list ) সমর্থিত নয় , যদিও অন্যান্য গাণিতিক অপারেটর সমর্থিত।


৩. মূল কার্যাবলী

সাধারণ ও স্ট্রিং ফাংশন

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
size একটি স্ট্রিং (ক্যারেক্টার), বাইট, লিস্ট বা ম্যাপের সাইজ রিটার্ন করে।

স্বাক্ষরসমূহ:
size(T) -> int (যেখানে T হলো string , bytes , list , বা map )

উদাহরণ:
size("hello") // 5
contains স্ট্রিংটিতে কোনো সাবস্ট্রিং আছে কিনা তা ফেরত দেয়।

স্বাক্ষরসমূহ:
string.contains(string) -> bool

উদাহরণ:
"hello".contains("ell") // true
startsWith স্ট্রিংটি কোনো প্রিফিক্স দিয়ে শুরু হয় কিনা তা ফেরত দেয়।

স্বাক্ষরসমূহ:
string.startsWith(string) -> bool

উদাহরণ:
"hello".startsWith("he") // true
endsWith স্ট্রিংটি সাফিক্স সহ শেষ হয় কিনা তা ফেরত দেয়।

স্বাক্ষরসমূহ:
string.endsWith(string) -> bool

উদাহরণ:
"hello".endsWith("lo") // true
matches স্ট্রিংটি RE2 রেগুলার এক্সপ্রেশনের সাথে মেলে কিনা তা ফেরত দেয়।

স্বাক্ষরসমূহ:
string.matches(string) -> bool

উদাহরণ:
"123".matches(r"^\d+$") // true

তারিখ এবং সময় নির্বাচক ফাংশন

এই ফাংশনগুলো google.protobuf.Timestamp অথবা google.protobuf.Duration থেকে উপাদানগুলো নিষ্কাশন করে।

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
getFullYear চার-অঙ্কের বছরটি ফেরত দেয়।

স্বাক্ষরসমূহ:
timestamp.getFullYear([tz]) -> int

উদাহরণ:
timestamp("2026-07-23T00:00:00Z").getFullYear() // 2026
getMonth মাসটি (০-১১) ফেরত দেয়।

স্বাক্ষরসমূহ:
timestamp.getMonth([tz]) -> int

উদাহরণ:
timestamp("2026-07-23T00:00:00Z").getMonth() // 6
getDayOfMonth মাসের দিনটি (১-৩১) দেখায়।

স্বাক্ষরসমূহ:
timestamp.getDayOfMonth([tz]) -> int

উদাহরণ:
timestamp("2026-07-23T00:00:00Z").getDayOfMonth() // 23
getDayOfWeek সপ্তাহের দিনটি জানায় (০ = রবিবার)।

স্বাক্ষরসমূহ:
timestamp.getDayOfWeek([tz]) -> int

উদাহরণ:
timestamp("2026-07-23T00:00:00Z").getDayOfWeek() // 4
getDayOfYear বছরের দিনটি (০-৩৬৫) জানায়।

স্বাক্ষরসমূহ:
timestamp.getDayOfYear([tz]) -> int

উদাহরণ:
timestamp("2026-07-23T00:00:00Z").getDayOfYear() // 203
getHours ঘন্টা (০-২৩) ফেরত দেয়।

স্বাক্ষরসমূহ:
timestamp.getHours([tz]) -> int
duration.getHours() -> int

উদাহরণ:
duration("1h30m").getHours() // 1
getMinutes মিনিট (০-৫৯) ফেরত দেয়।

স্বাক্ষরসমূহ:
timestamp.getMinutes([tz]) -> int
duration.getMinutes() -> int

উদাহরণ:
duration("1h30m").getMinutes() // 30
getSeconds সেকেন্ডে (০-৫৯) ফেরত দেয়।

স্বাক্ষরসমূহ:
timestamp.getSeconds([tz]) -> int
duration.getSeconds() -> int

উদাহরণ:
duration("1h30m45s").getSeconds() // 45
getMilliseconds মিলিসেকেন্ডে (০-৯৯৯) ফেরত দেয়।

স্বাক্ষরসমূহ:
timestamp.getMilliseconds([tz]) -> int
duration.getMilliseconds() -> int

উদাহরণ:
duration("1.5s").getMilliseconds() // 500

টাইপ রূপান্তর

লক্ষ্য প্রকার বর্ণনা যান সি++ জাভা পাইথন সি
bool বুলিয়ানে রূপান্তর করে।

স্বাক্ষরসমূহ:
bool(bool) -> bool
bool(string) -> bool

উদাহরণ:
bool("true") // true
bytes বাইটে রূপান্তর করে।

স্বাক্ষরসমূহ:
bytes(bytes) -> bytes
bytes(string) -> bytes

উদাহরণ:
bytes("hello") // b"hello"
double ডাবল-প্রিসিশন ফ্লোটে রূপান্তর করে।

স্বাক্ষরসমূহ:
double(double) -> double
double(int) -> double
double(uint) -> double
double(string) -> double

উদাহরণ:
double(1) // 1.0
duration সময়কালে রূপান্তরিত করে।

স্বাক্ষরসমূহ:
duration(duration) -> duration
duration(string) -> duration

উদাহরণ:
duration("1.5s") // 1.5s duration
int ৬৪-বিট স্বাক্ষরিত পূর্ণসংখ্যায় রূপান্তর করে।

স্বাক্ষরসমূহ:
int(int) -> int
int(uint) -> int
int(double) -> int (শূন্যে রাউন্ড হয়)
int(string) -> int
int(timestamp) -> int (ইপক থেকে সেকেন্ড)

উদাহরণ:
int(1.5) // 1
string স্ট্রিং-এ রূপান্তর করে।

স্বাক্ষরসমূহ:
string(T) -> string (যা bool , int , uint , double , bytes , timestamp , duration সমর্থন করে)

উদাহরণ:
string(1.5) // "1.5"
timestamp টাইমস্ট্যাম্পে রূপান্তর করে।

স্বাক্ষরসমূহ:
timestamp(timestamp) -> timestamp
timestamp(string) -> timestamp (RFC3339)

উদাহরণ:
timestamp("2026-07-23T00:00:00Z")
uint ৬৪-বিটের অচিহ্নিত পূর্ণসংখ্যায় রূপান্তর করে।

স্বাক্ষরসমূহ:
uint(uint) -> uint
uint(int) -> uint
uint(double) -> uint
uint(string) -> uint

উদাহরণ:
uint(1) // 1u
dyn টাইপ-চেকিংয়ের জন্য ভ্যালুকে ডাইনামিক টাইপে রূপান্তর করে।

স্বাক্ষরসমূহ:
dyn(T) -> dyn

উদাহরণ:
dyn([1, "two"])
type মানটির ধরন ফেরত দেয়।

স্বাক্ষরসমূহ:
type(T) -> type

উদাহরণ:
type(1) // int

৪. এক্সটেনশন (লাইব্রেরি)

বাইন্ডিং লাইব্রেরি

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
cel.bind ডুপ্লিকেট ইভ্যালুয়েশন এড়ানোর জন্য একটি লোকাল ভেরিয়েবল বাইন্ড করে।

স্বাক্ষরসমূহ:
cel.bind(varName, initExpr, resultExpr) -> T

উদাহরণ:
cel.bind(x, a + b, x * x)
(v0.15.0) (v0.10.0) (v0.2.0) (v0.1.1)

কীভাবে সক্রিয় করবেন

  • যান: cel.NewEnv() ext.Bindings() ) পাস করুন।
  • C++: CompilerBuilderBindingsCompilerLibrary() যোগ করুন। (রানটাইম স্বয়ংক্রিয়ভাবে পরিচালিত হয়)।
  • জাভা: CelCompiler এবং CelRuntime বিল্ডারগুলিতে CelExtensions.bindings() যোগ করুন।
  • পাইথন: cel_expr_python.ext.ext_bindings ইম্পোর্ট করুন এবং cel.NewEnv(extensions=[...]) -এ ExtBindings() ব্যবহার করুন।

এনকোডার লাইব্রেরি

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
base64.encode বাইটগুলিকে বেস৬৪ স্ট্রিং-এ এনকোড করে।

স্বাক্ষরসমূহ:
base64.encode(bytes) -> string

উদাহরণ:
base64.encode(b"hello") // "aGVsbG8="
(v0.6.0) (v0.10.0) (v0.2.0) (v0.1.1)
base64.decode বেস৬৪ স্ট্রিংকে বাইটে ডিকোড করে। ভুল ইনপুট দিলে ত্রুটি দেখায়।

স্বাক্ষরসমূহ:
base64.decode(string) -> bytes

উদাহরণ:
base64.decode("aGVsbG8=") // b"hello"
(v0.6.0) (v0.10.0) (v0.2.0) (v0.1.1)
json.encode একটি CEL মানকে JSON স্ট্রিং-এ সিরিয়ালাইজ করে।

স্বাক্ষরসমূহ:
json.encode(dyn) -> string

উদাহরণ:
json.encode([1, 2]) // "[1,2]"
(v0.29.0)

কীভাবে সক্রিয় করবেন

  • যান: ext.Encoders() কে cel.NewEnv() -এ পাস করুন।
  • সি++:
  • জাভা: CelCompiler এবং CelRuntime বিল্ডারগুলিতে CelExtensions.encoders() যোগ করুন।
  • পাইথন: cel_expr_python.ext.ext_encoders ইম্পোর্ট করুন এবং cel.NewEnv(extensions=[...]) -এ ExtEncoders() ব্যবহার করুন।

গণিত গ্রন্থাগার

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
math.greatest সংখ্যাসূচক আর্গুমেন্টগুলোর (বা সংখ্যাসূচক সংখ্যার তালিকার) মধ্যে বৃহত্তমটি ফেরত দেয়।

স্বাক্ষরসমূহ:
math.greatest(arg, ...) -> T

উদাহরণ:
math.greatest(1, 3, 2) // 3
(v0.13.0) (v0.10.0) (v0.2.0) (v0.1.1)
math.least সংখ্যাসূচক আর্গুমেন্টগুলোর (বা সংখ্যাসূচক সংখ্যার তালিকার) মধ্যে সর্বনিম্ন মানটি ফেরত দেয়।

স্বাক্ষরসমূহ:
math.least(arg, ...) -> T

উদাহরণ:
math.least([1, 3, 2]) // 1
(v0.13.0) (v0.10.0) (v0.2.0) (v0.1.1)
math.abs পরম মান।

স্বাক্ষরসমূহ:
math.abs(T) -> T ( int , uint , double সমর্থন করে)

উদাহরণ:
math.abs(-1) // 1
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.sqrt বর্গমূল।

স্বাক্ষরসমূহ:
math.sqrt(T) -> double ( int , uint , double সমর্থন করে)

উদাহরণ:
math.sqrt(9) // 3.0
(v0.25.1) (v0.12.0) (v0.11.0) (v0.1.1)
math.bitAnd বিটওয়াইজ AND।

স্বাক্ষরসমূহ:
math.bitAnd(T, T) -> T ( int , uint সমর্থন করে)

উদাহরণ:
math.bitAnd(5, 3) // 1
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.bitOr বিটওয়াইজ OR।

স্বাক্ষরসমূহ:
math.bitOr(T, T) -> T ( int , uint সমর্থন করে)

উদাহরণ:
math.bitOr(5, 3) // 7
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.bitXor বিটওয়াইজ XOR।

স্বাক্ষরসমূহ:
math.bitXor(T, T) -> T ( int , uint সমর্থন করে)

উদাহরণ:
math.bitXor(5, 3) // 6
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.bitNot বিটওয়াইজ নয়।

স্বাক্ষরসমূহ:
math.bitNot(T) -> T ( int , uint সমর্থন করে)

উদাহরণ:
math.bitNot(1) // -2
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.bitShiftLeft বিটওয়াইজ বামে সরান।

স্বাক্ষরসমূহ:
math.bitShiftLeft(T, int) -> T ( int , uint সমর্থন করে)

উদাহরণ:
math.bitShiftLeft(1, 2) // 4
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.bitShiftRight বিটওয়াইজ শিফট রাইট।

স্বাক্ষরসমূহ:
math.bitShiftRight(T, int) -> T ( int , uint সমর্থন করে)

উদাহরণ:
math.bitShiftRight(4, 2) // 1
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.ceil ছাদ গোলাকার করা।

স্বাক্ষরসমূহ:
math.ceil(double) -> double

উদাহরণ:
math.ceil(1.2) // 2.0
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.floor মেঝে গোলাকার করা।

স্বাক্ষরসমূহ:
math.floor(double) -> double

উদাহরণ:
math.floor(1.8) // 1.0
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.round নিকটতম পূর্ণসংখ্যায় রাউন্ডিং।

স্বাক্ষরসমূহ:
math.round(double) -> double

উদাহরণ:
math.round(1.5) // 2.0
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.trunc ট্রাঙ্কেশন রাউন্ডিং (শূন্যের দিকে)।

স্বাক্ষরসমূহ:
math.trunc(double) -> double

উদাহরণ:
math.trunc(-1.8) // -1.0
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.isInf ডাবলটি ধনাত্মক না ঋণাত্মক অসীম তা যাচাই করে।

স্বাক্ষরসমূহ:
math.isInf(double) -> bool

উদাহরণ:
math.isInf(1.0/0.0) // true
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.isNaN ডাবলটি NaN কিনা তা যাচাই করে।

স্বাক্ষরসমূহ:
math.isNaN(double) -> bool

উদাহরণ:
math.isNaN(0.0/0.0) // true
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.isFinite ডাবলটি সসীম কিনা তা যাচাই করে।

স্বাক্ষরসমূহ:
math.isFinite(double) -> bool

উদাহরণ:
math.isFinite(1.2) // true
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.sign মানের চিহ্ন (-১, ০, বা ১) ফেরত দেয়।

স্বাক্ষরসমূহ:
math.sign(T) -> T ( int , uint , double সমর্থন করে)

উদাহরণ:
math.sign(-42) // -1
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)

কীভাবে সক্রিয় করবেন

  • যান: cel.NewEnv() ext.Math() পাস করুন।
  • সি++:
  • জাভা: CelCompiler এবং CelRuntime বিল্ডারগুলিতে CelExtensions.math() যোগ করুন।
  • পাইথন: cel_expr_python.ext.ext_math ইম্পোর্ট করুন এবং cel.NewEnv(extensions=[...]) -এ ExtMath() ব্যবহার করুন।

প্রোটোস লাইব্রেরি

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
proto.getExt প্রোটো২ এক্সটেনশন ফিল্ডটি গ্রহণ করে, অথবা সেট করা না থাকলে ডিফল্টটি গ্রহণ করে।

স্বাক্ষরসমূহ:
proto.getExt(msg, extName) -> T

উদাহরণ:
proto.getExt(msg, google.api.expr.test.int32_ext)
(v0.13.0) (v0.10.0) (v0.2.0) (v0.1.1)
proto.hasExt প্রোটো২ এক্সটেনশন ফিল্ড সেট করা আছে কিনা তা যাচাই করে।

স্বাক্ষরসমূহ:
proto.hasExt(msg, extName) -> bool

উদাহরণ:
proto.hasExt(msg, google.api.expr.test.int32_ext)
(v0.13.0) (v0.10.0) (v0.2.0) (v0.1.1)

কীভাবে সক্রিয় করবেন

  • যান: cel.NewEnv() ext.Protos() ) পাস করুন।
  • C++: CompilerBuilderProtoExtCompilerLibrary() যোগ করুন। (রানটাইম স্বয়ংক্রিয়ভাবে পরিচালিত হয়)।
  • জাভা: CelCompiler এবং CelRuntime বিল্ডারগুলিতে CelExtensions.protos() যোগ করুন।
  • পাইথন: cel_expr_python.ext.ext_proto ইম্পোর্ট করুন এবং cel.NewEnv(extensions=[...]) -এ ExtProto() ব্যবহার করুন।

তালিকা লাইব্রেরি

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
distinct স্বতন্ত্র উপাদানগুলো ফেরত দেয়।

স্বাক্ষরসমূহ:
list.distinct() -> list

উদাহরণ:
[1, 2, 2].distinct() // [1, 2]
(v0.22.0) (v0.11.0) (v0.11.0) (v0.1.1)
flatten নেস্টেড লিস্টকে ফ্ল্যাট করে।

স্বাক্ষরসমূহ:
list.flatten([depth]) -> list

উদাহরণ:
[[1], [2, 3]].flatten() // [1, 2, 3]
(v0.22.0) (v0.11.0) (v0.7.1) (v0.1.1)
lists.range [0, ..., n-1] পূর্ণসংখ্যার একটি তালিকা ফেরত দেয়।

স্বাক্ষরসমূহ:
lists.range(int) -> list(int)

উদাহরণ:
lists.range(3) // [0, 1, 2]
(v0.22.0) (v0.11.0) (v0.10.1) (v0.1.1)
reverse তালিকাটি উল্টে দেয়।

স্বাক্ষরসমূহ:
list.reverse() -> list

উদাহরণ:
[1, 2].reverse() // [2, 1]
(v0.22.0) (v0.11.0) (v0.11.0) (v0.1.1)
slice উপ-তালিকা ফেরত দেয় (শুরু অন্তর্ভুক্ত, শেষ বাদে)।

স্বাক্ষরসমূহ:
list.slice(start, end) -> list

উদাহরণ:
[1, 2, 3].slice(1, 3) // [2, 3]
(v0.17.0) (v0.11.0) (v0.11.0) (v0.1.1)
sort তুলনীয় উপাদানগুলোর তালিকা সাজায়।

স্বাক্ষরসমূহ:
list.sort() -> list

উদাহরণ:
[3, 1, 2].sort() // [1, 2, 3]
(v0.22.0) (v0.11.0) (v0.11.0) (v0.1.1)
sortBy এক্সপ্রেশন থেকে মূল্যায়ন করা কী (key) অনুযায়ী তালিকাটি সাজানো হয়।

স্বাক্ষরসমূহ:
list.sortBy(var, expr) -> list

উদাহরণ:
[{"val": 2}, {"val": 1}].sortBy(x, x.val) // [{"val": 1}, {"val": 2}]
(v0.22.0) (v0.11.0) (v0.11.0) (v0.1.1)
first প্রথম উপাদানটিকে ঐচ্ছিক হিসেবে ফেরত দেয়। এর জন্য Optional এক্সটেনশনটি প্রয়োজন।

স্বাক্ষরসমূহ:
list.first() -> optional

উদাহরণ:
[1, 2].first() // optional(1)
(v0.23.0) (v0.15.0) (v0.11.0) (v0.1.2)
last শেষ উপাদানটিকে ঐচ্ছিক হিসেবে ফেরত দেয়। এর জন্য Optional এক্সটেনশনটি প্রয়োজন।

স্বাক্ষরসমূহ:
list.last() -> optional

উদাহরণ:
[1, 2].last() // optional(2)
(v0.23.0) (v0.15.0) (v0.11.0) (v0.1.2)

কীভাবে সক্রিয় করবেন

  • যান: ext.Lists() কে cel.NewEnv() -এ পাস করুন।
  • সি++:
  • জাভা: CelCompiler এবং CelRuntime বিল্ডারগুলিতে CelExtensions.lists() যোগ করুন।
  • পাইথন: extensions তালিকায় lists যোগ করে cel.EnvConfig মাধ্যমে সক্রিয় করুন।

সেট লাইব্রেরি

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
sets.contains list1-এ list2-এর সমস্ত উপাদান আছে কি না, তা যাচাই করে।

স্বাক্ষরসমূহ:
sets.contains(list1, list2) -> bool

উদাহরণ:
sets.contains([1, 2], [1]) // true
(v0.15.0) (v0.10.0) (v0.6.0) (v0.1.1)
sets.equivalent তালিকাগুলো সেট-সমতুল্য কিনা (অর্থাৎ সেগুলোতে একই অনন্য উপাদান আছে কিনা) তা যাচাই করে।

স্বাক্ষরসমূহ:
sets.equivalent(list1, list2) -> bool

উদাহরণ:
sets.equivalent([1, 2], [2, 1, 1]) // true
(v0.15.0) (v0.10.0) (v0.6.0) (v0.1.1)
sets.intersects তালিকাগুলোর মধ্যে অন্তত একটি সাধারণ উপাদান আছে কিনা তা যাচাই করে।

স্বাক্ষরসমূহ:
sets.intersects(list1, list2) -> bool

উদাহরণ:
sets.intersects([1, 2], [2, 3]) // true
(v0.15.0) (v0.10.0) (v0.6.0) (v0.1.1)

কীভাবে সক্রিয় করবেন

  • যান: cel.NewEnv() ext.Sets() ) পাস করুন।
  • সি++:
  • জাভা: CelCompiler এবং CelRuntime বিল্ডারগুলিতে CelExtensions.sets() যোগ করুন।
  • পাইথন: extensions তালিকায় sets যোগ করে cel.EnvConfig মাধ্যমে এটি সক্রিয় করুন।

স্ট্রিংস লাইব্রেরি

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
charAt ইনডেক্সে থাকা ক্যারেক্টারটি ফেরত দেয়।

স্বাক্ষরসমূহ:
string.charAt(int) -> string

উদাহরণ:
"hello".charAt(1) // "e"
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
indexOf সাবস্ট্রিংটির প্রথম উপস্থিতির সূচক, অথবা -১ ফেরত দেয়।

স্বাক্ষরসমূহ:
string.indexOf(substr, [start]) -> int

উদাহরণ:
"hello".indexOf("l") // 2
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
lastIndexOf সাবস্ট্রিংটির সর্বশেষ উপস্থিতির সূচক, অথবা -১ ফেরত দেয়।

স্বাক্ষরসমূহ:
string.lastIndexOf(substr, [end]) -> int

উদাহরণ:
"hello".lastIndexOf("l") // 3
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
join স্ট্রিং সংযুক্ত করে।

স্বাক্ষরসমূহ:
list(string).join([separator]) -> string

উদাহরণ:
["a", "b"].join("-") // "ab"
(v0.10.0) (v0.10.0) (v0.2.0) (v0.1.1)
split বিভাজক দ্বারা স্ট্রিং বিভক্ত করে।

স্বাক্ষরসমূহ:
string.split(separator, [limit]) -> list(string)

উদাহরণ:
"ab".split("-") // ["a", "b"]
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
substring সাবস্ট্রিং ফেরত দেয় (শুরু অন্তর্ভুক্ত, শেষ বাদে)।

স্বাক্ষরসমূহ:
string.substring(start, [end]) -> string

উদাহরণ:
"hello".substring(1, 3) // "el"
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
trim ইউনিকোড হোয়াইটস্পেস ছাঁটাই করে।

স্বাক্ষরসমূহ:
string.trim() -> string

উদাহরণ:
" hello ".trim() // "hello"
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
replace পুরানোগুলোর পরিবর্তে নতুনগুলো প্রতিস্থাপন করে।

স্বাক্ষরসমূহ:
string.replace(old, new, [limit]) -> string

উদাহরণ:
"hello".replace("l", "w") // "hewwo"
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
reverse ইউনিকোড কোড পয়েন্টগুলোকে উল্টে দেয়।

স্বাক্ষরসমূহ:
string.reverse() -> string

উদাহরণ:
"abc".reverse() // "cba"
(v0.18.0) (v0.14.0) (v0.13.0) (v0.1.1)
lowerAscii ASCII অক্ষরগুলোকে ছোট হাতের অক্ষরে রূপান্তর করে।

স্বাক্ষরসমূহ:
string.lowerAscii() -> string

উদাহরণ:
"Hello".lowerAscii() // "hello"
(v0.6.0) (v0.11.0) (v0.2.0) (v0.1.1)
upperAscii ASCII অক্ষরগুলোকে বড় হাতের অক্ষরে রূপান্তর করে।

স্বাক্ষরসমূহ:
string.upperAscii() -> string

উদাহরণ:
"Hello".upperAscii() // "HELLO"
(v0.6.0) (v0.11.0) (v0.2.0) (v0.1.1)
quote নিরাপদ মুদ্রণের জন্য স্ট্রিং এস্কেপ করা হয়।

স্বাক্ষরসমূহ:
strings.quote(string) -> string

উদাহরণ:
strings.quote("a\tb") // "\"a\\tb\""
(v0.14.0) (v0.14.0) (v0.13.0) (v0.1.1)
format printf-এর মতো প্লেসহোল্ডার ব্যবহার করে স্ট্রিংটি ফরম্যাট করে।

স্বাক্ষরসমূহ:
string.format(list) -> string

উদাহরণ:
"str: %s, int: %d".format(["a", 1]) // "str: a, int: 1"
(v0.14.0) (v0.11.0) (v0.1.1)

কীভাবে সক্রিয় করবেন

  • যান: ext.Strings() কে cel.NewEnv() -এ পাস করুন।
  • সি++:
  • জাভা: CelCompiler এবং CelRuntime বিল্ডারগুলিতে CelExtensions.strings() যোগ করুন।
  • পাইথন: cel_expr_python.ext.ext_strings ইম্পোর্ট করুন এবং cel.NewEnv(extensions=[...]) -এ ExtStrings() ব্যবহার করুন।

রেগুলার এক্সপ্রেশন লাইব্রেরি

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
regex.replace মিলগুলোকে প্রতিস্থাপন স্ট্রিং দিয়ে বদলে দেয় (ব্যাকরেফারেন্স সমর্থন করে)।

স্বাক্ষরসমূহ:
regex.replace(target, pat, repl, [limit]) -> string

উদাহরণ:
regex.replace("123-456", r"(\d+)-(\d+)", r"\2-\1") // "456-123"
(v0.25.1) (v0.13.0) (v0.10.1) (v0.1.1)
regex.extract প্যাটার্নের প্রথম মিলটি ফেরত দেয় (এতে অবশ্যই একটি ক্যাপচার গ্রুপ থাকতে হবে)।

স্বাক্ষরসমূহ:
regex.extract(target, pat) -> optional(string)

উদাহরণ:
regex.extract("a123b", r"(\d+)") // optional("123")
(v0.25.1) (v0.13.0) (v0.10.1) (v0.1.1)
regex.extractAll প্যাটার্নটির সমস্ত মিল ফেরত দেয় (এতে অবশ্যই একটি ক্যাপচার গ্রুপ থাকতে হবে)।

স্বাক্ষরসমূহ:
regex.extractAll(target, pat) -> list(string)

উদাহরণ:
regex.extractAll("a1b2", r"(\d+)") // ["1", "2"]
(v0.25.1) (v0.13.0) (v0.10.1) (v0.1.1)

কীভাবে সক্রিয় করবেন

  • যান: cel.NewEnv() ext.Regex() ) পাস করুন।
  • সি++:
  • জাভা: CelCompiler এবং CelRuntime বিল্ডারগুলিতে CelExtensions.regex() যোগ করুন।
  • পাইথন: cel.EnvConfig এর extensions তালিকায় regex এবং optional যোগ করে এটি সক্রিয় করুন।

দ্বি-চলক বোধগম্যতা

ম্যাক্রো বর্ণনা যান সি++ জাভা পাইথন সি
all কী/ইনডেক্স এবং ভ্যালুর মধ্যে লজিক্যাল AND ফাংশনের শর্ট-সার্কিটিং।

স্বাক্ষরসমূহ:
list.all(i, v, pred) -> bool
map.all(k, v, pred) -> bool

উদাহরণ:
[1, 2].all(i, v, v > 0) // true
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)
exists কী/ইনডেক্স এবং ভ্যালুর মধ্যে লজিক্যাল OR শর্ট-সার্কিট করা।

স্বাক্ষরসমূহ:
list.exists(i, v, pred) -> bool
map.exists(k, v, pred) -> bool

উদাহরণ:
[1, 2].exists(i, v, v == 2) // true
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)
existsOne যাচাই করে যে ঠিক একটি জোড়া শর্তটি পূরণ করে কি না।

স্বাক্ষরসমূহ:
list.existsOne(i, v, pred) -> bool
map.existsOne(k, v, pred) -> bool

উদাহরণ:
[1, 2].existsOne(i, v, v == 2) // true
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)
transformList তালিকা/ম্যাপকে একটি তালিকায় রূপান্তর বা ফিল্টার করে।

স্বাক্ষরসমূহ:
list.transformList(i, v, [filter], transform) -> list
map.transformList(k, v, [filter], transform) -> list

উদাহরণ:
[1, 2].transformList(i, v, v * 2) // [2, 4]
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)
transformMap লিস্ট/ম্যাপের মানগুলোকে একটি ম্যাপে রূপান্তর করে (কীগুলো অপরিবর্তিত থাকে)।

স্বাক্ষরসমূহ:
list.transformMap(i, v, [filter], transform) -> map
map.transformMap(k, v, [filter], transform) -> map

উদাহরণ:
[1, 2].transformMap(i, v, v * 2) // {0: 2, 1: 4}
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)
transformMapEntry মানচিত্রে রূপান্তরিত হয়।

স্বাক্ষরসমূহ:
list.transformMapEntry(i, v, [filter], transform_entry) -> map
map.transformMapEntry(k, v, [filter], transform_entry) -> map

উদাহরণ:
[1, 2].transformMapEntry(i, v, {string(v): v * 2}) // {"1": 2, "2": 4}
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)

কীভাবে সক্রিয় করবেন

নেটিভ টাইপস লাইব্রেরি

বৈশিষ্ট্য বর্ণনা যান সি++ জাভা পাইথন সি
নেটিভ স্ট্রাক্টস CEL-এ হোস্ট নেটিভ টাইপ (Go struct / Java POJO) নিবন্ধন এবং ইনস্ট্যানশিয়েট করা।

উদাহরণ:
Account{id: 123} (সিইএল-এ ইনস্ট্যান্সকৃত জাভা পিওজো)
(v0.13.0) (v0.13.0)

কীভাবে সক্রিয় করবেন

  • Go: cel.NewEnv() cel.NativeTypes(...) ) অথবা ext.NativeTypes(...) (রিফ্লেক্ট টাইপ প্রদানকারী) পাস করুন।
  • সি++ সমর্থিত নয়।
  • জাভা: CelCompiler এবং CelRuntime বিল্ডারগুলিতে CelExtensions.nativeTypes() (জাভা ক্লাস সরবরাহ করার জন্য) যোগ করুন।
  • পাইথন: সমর্থিত নয়।

নেটওয়ার্ক লাইব্রেরি

নেটওয়ার্ক লাইব্রেরিটি আইপি অ্যাড্রেস এবং সিআইডিআর ব্লক পার্সিং, ভ্যালিডেশন এবং ম্যানিপুলেট করার জন্য ফাংশন সরবরাহ করে।

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
ip একটি স্ট্রিংকে পার্স করে আইপি অ্যাড্রেসে রূপান্তর করে, অথবা সিআইডিআর (CIDR) থেকে আইপি বের করে।

স্বাক্ষরসমূহ:
ip(string) -> IP
CIDR.ip() -> IP

উদাহরণ:
ip("192.168.0.1")
cidr("192.168.0.0/24").ip()
(v0.29.0)
isIP একটি স্ট্রিং বৈধ আইপি অ্যাড্রেস কিনা তা যাচাই করে।

স্বাক্ষরসমূহ:
isIP(string) -> bool

উদাহরণ:
isIP("192.168.0.1") // true
(v0.29.0)
ip.isCanonical একটি আইপি অ্যাড্রেস স্ট্রিং তার প্রমিত বিন্যাসে আছে কিনা তা যাচাই করে।

স্বাক্ষরসমূহ:
ip.isCanonical(string) -> bool

উদাহরণ:
ip.isCanonical("192.168.0.1") // true
(v0.29.0)
cidr একটি স্ট্রিংকে পার্স করে একটি CIDR ব্লকে রূপান্তর করে।

স্বাক্ষরসমূহ:
cidr(string) -> CIDR

উদাহরণ:
cidr("192.168.0.0/24")
(v0.29.0)
isCIDR একটি স্ট্রিং বৈধ CIDR ব্লক কিনা তা যাচাই করে।

স্বাক্ষরসমূহ:
isCIDR(string) -> bool

উদাহরণ:
isCIDR("192.168.0.0/24") // true
(v0.29.0)
containsIP একটি CIDR ব্লকে IP অ্যাড্রেস আছে কিনা তা যাচাই করে।

স্বাক্ষরসমূহ:
CIDR.containsIP(IP) -> bool
CIDR.containsIP(string) -> bool

উদাহরণ:
cidr("192.168.0.0/24").containsIP(ip("192.168.0.1")) // true
(v0.29.0)
containsCIDR একটি CIDR ব্লকের মধ্যে অন্য একটি CIDR ব্লক আছে কিনা তা যাচাই করে।

স্বাক্ষরসমূহ:
CIDR.containsCIDR(CIDR) -> bool
CIDR.containsCIDR(string) -> bool

উদাহরণ:
cidr("192.168.0.0/16").containsCIDR(cidr("192.168.1.0/24")) // true
(v0.29.0)
family আইপি ফ্যামিলি ফেরত দেয় (IPv4-এর জন্য 4, IPv6-এর জন্য 6)।

স্বাক্ষরসমূহ:
IP.family() -> int

উদাহরণ:
ip("192.168.0.1").family() // 4
(v0.29.0)
isGlobalUnicast আইপিটি একটি গ্লোবাল ইউনিকাস্ট অ্যাড্রেস কিনা তা যাচাই করে।

স্বাক্ষরসমূহ:
IP.isGlobalUnicast() -> bool

উদাহরণ:
ip("192.168.0.1").isGlobalUnicast() // true
(v0.29.0)
isLinkLocalMulticast আইপিটি একটি লিঙ্ক-লোকাল মাল্টিকাস্ট অ্যাড্রেস কিনা তা যাচাই করে।

স্বাক্ষরসমূহ:
IP.isLinkLocalMulticast() -> bool

উদাহরণ:
ip("224.0.0.1").isLinkLocalMulticast() // true
(v0.29.0)
isLinkLocalUnicast আইপিটি একটি লিঙ্ক-লোকাল ইউনিকাস্ট অ্যাড্রেস কিনা তা যাচাই করে।

স্বাক্ষরসমূহ:
IP.isLinkLocalUnicast() -> bool

উদাহরণ:
ip("169.254.0.1").isLinkLocalUnicast() // true
(v0.29.0)
isLoopback আইপিটি লুপব্যাক অ্যাড্রেস কিনা তা যাচাই করে।

স্বাক্ষরসমূহ:
IP.isLoopback() -> bool

উদাহরণ:
ip("127.0.0.1").isLoopback() // true
(v0.29.0)
isMask CIDR-টি একটি বৈধ সাবনেট মাস্ক কিনা তা যাচাই করে।

স্বাক্ষরসমূহ:
CIDR.isMask() -> bool

উদাহরণ:
cidr("255.255.255.0/24").isMask() // true
(v0.29.0)
isUnspecified আইপি ঠিকানাটি অনির্দিষ্ট কিনা তা যাচাই করে (যেমন 0.0.0.0 )।

স্বাক্ষরসমূহ:
IP.isUnspecified() -> bool

উদাহরণ:
ip("0.0.0.0").isUnspecified() // true
(v0.29.0)
masked মাস্ক করা CIDR ব্লকটি ফেরত দেয়।

স্বাক্ষরসমূহ:
CIDR.masked() -> CIDR

উদাহরণ:
cidr("192.168.0.1/24").masked() // 192.168.0.0/24
(v0.29.0)
prefixLength CIDR ব্লকের প্রিফিক্স দৈর্ঘ্য ফেরত দেয়।

স্বাক্ষরসমূহ:
CIDR.prefixLength() -> int

উদাহরণ:
cidr("192.168.0.0/24").prefixLength() // 24
(v0.29.0)
string আইপি বা সিআইডিআর-কে স্ট্রিং-এ রূপান্তর করে।

স্বাক্ষরসমূহ:
string(IP) -> string
string(CIDR) -> string

উদাহরণ:
string(ip("192.168.0.1")) // "192.168.0.1"
(v0.29.0)

কীভাবে সক্রিয় করবেন

  • যান: cel.NewEnv() ext.Network() পাস করুন।
  • সি++ সমর্থিত নয়।
  • জাভা: সমর্থিত নয়।
  • পাইথন: সমর্থিত নয়।

জেডব্লিউটি লাইব্রেরি

JWT লাইব্রেরিটি JSON ওয়েব টোকেন (JWT) পার্স করার এবং স্ট্যান্ডার্ড ও কাস্টম ক্লেইমগুলো পরীক্ষা করার জন্য ডেটা টাইপ ও সহায়ক ফাংশন সরবরাহ করে।

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
jwt.parse একটি অ-টোকেন স্ট্রিংকে পার্স করে একটি ঐচ্ছিক টোকেনের মধ্যে মোড়ানো কাঠামোগত jwt.Token এ রূপান্তর করে।

স্বাক্ষরসমূহ:
jwt.parse(string) -> optional(jwt.Token)

উদাহরণ:
jwt.parse(token_string).hasValue()
(v0.32.0)
claim টোকেন পেলোড থেকে কী-এর নাম ব্যবহার করে একটি কাস্টম ক্লেইম ভ্যালু কোয়েরি করে।

স্বাক্ষরসমূহ:
jwt.Token.claim(string) -> optional(dyn)
optional(jwt.Token).claim(string) -> optional(dyn)

উদাহরণ:
jwt.parse(token).claim("tenant").orValue("")
(v0.32.0)
presentedBy টোকেনটির ইস্যুকারী এবং দর্শক প্রত্যাশিত মানের সাথে মেলে কিনা তা যাচাই করে।

স্বাক্ষরসমূহ:
jwt.Token.presentedBy(string, string) -> bool
optional(jwt.Token).presentedBy(string, string) -> bool

উদাহরণ:
jwt.parse(token).presentedBy("https://auth.example.com", "https://api.example.com")
(v0.32.0)

কীভাবে সক্রিয় করবেন

  • Go: cel.dev/cel-go/ext/security/jwt ইম্পোর্ট করুন এবং cel.NewEnv() -এ jwt.Library() পাস করুন।
  • সি++ সমর্থিত নয়।
  • জাভা: সমর্থিত নয়।
  • পাইথন: সমর্থিত নয়।

এইচএমএসি লাইব্রেরি

HMAC লাইব্রেরিটি স্ট্রিং এবং বাইট সিকোয়েন্সের উপর হ্যাশ-ভিত্তিক মেসেজ অথেন্টিকেশন কোড (HMAC) গণনা ও যাচাই করার জন্য ক্রিপ্টোগ্রাফিক ফাংশন সরবরাহ করে।

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
hmac.compute নির্দিষ্ট অ্যালগরিদম এবং গোপন কী ব্যবহার করে মূল HMAC সিগনেচার বাইট গণনা করে।

স্বাক্ষরসমূহ:
hmac.compute(string, string|bytes, string|bytes) -> bytes

উদাহরণ:
hmac.compute(hmac.SHA256, "secret", "message")
(v0.32.0)
hmac.verify HMAC সিগনেচারটি প্রত্যাশিত ডাইজেস্টের সাথে মেলে কিনা তা যাচাই করে।

স্বাক্ষরসমূহ:
hmac.verify(string, string|bytes, string|bytes, string|bytes) -> bool

উদাহরণ:
hmac.verify(hmac.SHA256, secret, msg, expected_sig) // true
(v0.32.0)

কীভাবে সক্রিয় করবেন

  • Go: cel.dev/cel-go/ext/security/hmac ইম্পোর্ট করুন এবং cel.NewEnv() -এ hmac.Library() পাস করুন।
  • সি++ সমর্থিত নয়।
  • জাভা: সমর্থিত নয়।
  • পাইথন: সমর্থিত নয়।

৫. উন্নত বৈশিষ্ট্য

উন্নত বৈশিষ্ট্যগুলির সারাংশ

বৈশিষ্ট্য বর্ণনা যান সি++ জাভা পাইথন সি
আংশিক মূল্যায়ন অনুপস্থিত ইনপুট দিয়ে মূল্যায়ন করলে, এটি অজানা মান অথবা একটি সরলীকৃত রাশি ফেরত দেয়। ³
অ্যাসিঙ্ক মূল্যায়ন এক্সটেনশন ফাংশনগুলোর নন-ব্লকিং কনকারেন্ট এক্সিকিউশন।
AST ভ্যালিডেটর টাইপ-চেকিংয়ের পরে চেক করা AST-এর উপর স্ট্যাটিক অ্যানালাইসিস যাচাই করা হয়।
AST অপ্টিমাইজার পারফরম্যান্স উন্নত করার জন্য AST কোড পুনর্লিখন করে (যেমন: কনস্ট্যান্ট ফোল্ডিং, ইনলাইনিং, CSE)।
সিইএল পলিসি কম্পাইলার YAML-ভিত্তিক পলিসি কাঠামোকে স্ট্যান্ডার্ড CEL AST-তে কম্পাইল করে।
আনুষ্ঠানিক যাচাইকরণ সেফটি ইনভেরিয়েন্ট, স্যাটিসফাইবিলিটি, ভ্যালিডিটি এবং AST ইকুইভ্যালেন্স প্রমাণ করে। (v0.14.0)

³ Go রেসিডুয়াল AST (প্রুনড AST) তৈরি করা সমর্থন করে। ⁴ C++ এবং Java রানটাইমে UnknownSet / CelUnknownSet রিটার্ন করা সমর্থন করে, কিন্তু রেসিডুয়াল AST তৈরির জন্য কোনো পাবলিক API প্রকাশ করে না। ⁵ Go চ্যানেল রিটার্ন করার জন্য AsyncBinding / AsyncOp ব্যবহার করে। ⁶ Java ListenableFuture রিটার্ন করার জন্য CelAsyncRuntime ব্যবহার করে।

আংশিক মূল্যায়ন (অজানা বিষয়)

আংশিক মূল্যায়ন এমন পরিস্থিতিতেও কোনো এক্সপ্রেশন মূল্যায়ন করার সুযোগ দেয়, যখন ইনপুট ভেরিয়েবলগুলোর (আর্গুমেন্ট) কেবল একটি উপসেট জানা থাকে। মূল্যায়নটি ব্যর্থ না হয়ে, এমন একটি ফলাফল তৈরি করে যা নির্দেশ করে কী অনুপস্থিত, অথবা একটি সরলীকৃত এক্সপ্রেশন প্রদান করে।

  • Go: সম্পূর্ণ সমর্থন। অজানা অ্যাট্রিবিউটের প্যাটার্ন সহ একটি PartialActivation সংজ্ঞায়িত করার সুযোগ দেয়। ইভ্যালুয়েশন একটি types.Unknown ভ্যালু রিটার্ন করে। Go একটি Residual AST ( Env.ResidualAst ) তৈরি করা সমর্থন করে, যা হলো একটি ছাঁটাই করা, সরলীকৃত AST এবং এতে এক্সপ্রেশনের শুধুমাত্র সেই অংশগুলো থাকে যা ইভ্যালুয়েট করা যায়নি।
  • C++: Unknown মান সমর্থন করে। অজানা অ্যাট্রিবিউট প্যাটার্নগুলো Activation::set_unknown_attribute_patterns এর মাধ্যমে কনফিগার করা হয়। ইভ্যালুয়েশন একটি UnknownSet রিটার্ন করে। পাবলিক এপিআই বর্তমানে রেসিডুয়াল AST জেনারেশন প্রকাশ করে না।
  • জাভা: Program.eval() -এ PartialVars পাস করার মাধ্যমে আংশিক মূল্যায়ন সমর্থন করে। মূল্যায়ন একটি CelUnknownSet রিটার্ন করে। পাবলিক এপিআই বর্তমানে রেসিডুয়াল AST জেনারেশন প্রকাশ করে না।
  • পাইথন / সি: কোনো নেটিভ সাপোর্ট নেই।

অ্যাসিঙ্ক মূল্যায়ন

অ্যাসিঙ্ক ইভ্যালুয়েশন CEL এক্সপ্রেশনকে এমন ফাংশন কল করার সুযোগ দেয় যা অ্যাসিঙ্ক্রোনাসভাবে এক্সিকিউট হয় (যেমন, RPC বা ডাটাবেস কোয়েরি করা) এবং মূল এক্সিকিউশন থ্রেডকে ব্লক না করেই ফলাফল পাওয়া পর্যন্ত ইভ্যালুয়েশনকে আটকে রাখে।

  • Go: AsyncBinding এবং AsyncOp মাধ্যমে অ্যাসিঙ্ক্রোনাস ফাংশন ওভারলোড সমর্থন করে। অ্যাসিঙ্ক ফাংশনগুলো একটি Go চ্যানেল ( <-chan ref.Val ) রিটার্ন করে, এবং ইন্টারপ্রেটার এর যুগপৎ সম্পাদন ও সিনক্রোনাইজেশন পরিচালনা করে।
  • জাভা: CelAsyncRuntime এবং AsyncProgram মাধ্যমে অ্যাসিঙ্ক ইভ্যালুয়েশন সমর্থন করে। এটি পেন্ডিং ভ্যালুগুলো উপস্থাপন করতে ListenableFuture ব্যবহার করে এবং ফিউচারগুলো রিজলভ হওয়ার সাথে সাথে স্বয়ংক্রিয়ভাবে ইভ্যালুয়েশন সম্পন্ন করে।
  • সি++ / পাইথন / সি: কোনো অন্তর্নির্মিত সমর্থন নেই।

AST ভ্যালিডেটর

প্রোগ্রামটি কার্যকর করার আগে, ভ্যালিডেটররা টাইপ-চেকিং শেষে ডোমেন-নির্দিষ্ট সীমাবদ্ধতা প্রয়োগ করার জন্য পরীক্ষিত AST-এর উপর স্ট্যাটিক বিশ্লেষণ সম্পাদন করে।

  • Go: ASTValidator ইন্টারফেস সমর্থন করে। প্রামাণ্য ভ্যালিডেটরগুলোর মধ্যে রয়েছে cel.validator.duration , cel.validator.timestamp , cel.validator.matches (regex), cel.validator.homogeneous_literals , এবং cel.validator.comprehension_nesting_limit
  • C++: cel::Validator সমর্থন করে। প্রমিত ভ্যালিডেশনগুলোর মধ্যে রয়েছে AstDepthValidator , ComprehensionNestingLimitValidator , DurationLiteralValidator , HomogeneousLiteralValidator , MatchesValidator এবং TimestampLiteralValidator
  • জাভা: CelValidator এবং CelAstValidator সমর্থন করে। প্রমিত ভ্যালিডেটরগুলোর মধ্যে রয়েছে AstDepthLimitValidator , ComprehensionNestingLimitValidator , DurationLiteralValidator , HomogeneousLiteralValidator , RegexLiteralValidator এবং TimestampLiteralValidator
  • পাইথন / সি: সরাসরি সমর্থন নেই।

AST অপ্টিমাইজার

অপ্টিমাইজাররা এক্সিকিউশন পারফরম্যান্স উন্নত করার জন্য AST পুনর্লিখন করে। অপ্টিমাইজাররা দুটি শ্রেণীর অন্তর্ভুক্ত: স্ট্যাটিক এবং রানটাইম অপ্টিমাইজার। C++, Java, এবং Go রানটাইম অপ্টিমাইজেশন সমর্থন করে। CEL Java এবং Go স্ট্যাটিক অপ্টিমাইজারও সমর্থন করে।

সাধারণ অপ্টিমাইজেশনগুলোর মধ্যে রয়েছে কনস্ট্যান্ট ফোল্ডিং (ধ্রুবক ইনপুট দিয়ে সাব-এক্সপ্রেশনগুলোর পূর্ব-মূল্যায়ন) এবং কমন সাব-এক্সপ্রেশন এলিমিনেশন (CSE)।

  • Go: কম্পাইলেশন/প্ল্যানিং চলাকালীন AST ফোল্ডিং সমর্থন করে।
  • C++: প্ল্যান করার সময় cel::extensions::EnableConstantFolding এক্সটেনশনের মাধ্যমে কনস্ট্যান্ট ফোল্ডিং সমর্থন করে।
  • জাভা: CelOptimizer ইন্টারফেস সমর্থন করে। প্রমিত অপটিমাইজারগুলোর মধ্যে রয়েছে ConstantFoldingOptimizer (যা প্রি-অর্ডার ট্র্যাভার্সাল, প্রোটোবাফ মেসেজ কনস্ট্যান্ট ফোল্ডিং এবং অ্যাগ্রিগেট বা অপশনাল প্রুনিং সমর্থন করে), InliningOptimizer এবং SubexpressionOptimizer (CSE)।
  • পাইথন / সি: সরাসরি সমর্থন নেই।

সিইএল পলিসি কম্পাইলার

CEL পলিসি হলো একটি YAML-ভিত্তিক ফরম্যাট, যা ভেরিয়েবল, ম্যাচ ব্লক, শর্তসাপেক্ষ আউটপুট এবং নেস্টেড রুলের সাথে একাধিক CEL এক্সপ্রেশন একত্রিত করার জন্য ব্যবহৃত হয়। এটি জটিল পলিসি ইঞ্জিনগুলোর (যেমন কুবারনেটিস অ্যাডমিশন কন্ট্রোল) জন্য ডিজাইন করা হয়েছে, যেখানে একক CEL এক্সপ্রেশন পাঠযোগ্যতা হারায়।

আনুষ্ঠানিক ভাষার সংজ্ঞা, বাক্য গঠন এবং সঙ্গতি সংক্রান্ত তথ্যের জন্য CEL Policy Specification দেখুন।

পলিসি কম্পাইলার এই YAML পলিসিগুলোকে একটি একক স্ট্যান্ডার্ড CEL AST-তে কম্পাইল করে, যার ফলে এগুলো স্ট্যান্ডার্ড CEL রানটাইমগুলোর সাথে সম্পূর্ণরূপে সামঞ্জস্যপূর্ণ হয় এবং সমস্ত পারফরম্যান্স ও সুরক্ষা নিশ্চয়তা লাভ করে।

  • Go: Go পলিসির মাধ্যমে সমর্থিত (অ্যাগ্রিগেট রুল ইভ্যালুয়েশন সিম্যান্টিকস সহ)।
  • সি++: সি++ নীতিমালার মাধ্যমে সমর্থিত।
  • জাভা: জাভা পলিসির মাধ্যমে সমর্থিত (যার মধ্যে পলিসি কনফিগে থাকা অ্যাগ্রিগেট রুল ইভ্যালুয়েশন সিম্যান্টিকস এবং শর্টহ্যান্ড টাইপ স্পেসিফায়ার অন্তর্ভুক্ত)।
  • পাইথন / সি: সরাসরি সমর্থিত নয়।

আনুষ্ঠানিক যাচাইকরণ কাঠামো

ফর্মাল ভেরিফিকেশন ফ্রেমওয়ার্কটি ব্যবহারকারীদের CEL এক্সপ্রেশন এবং স্ট্রাকচার্ড CEL পলিসি জুড়ে সেফটি ইনভেরিয়েন্ট, লজিক্যাল ইকুইভ্যালেন্স, স্যাটিসফায়াবিলিটি এবং ভ্যালিডিটি গাণিতিকভাবে প্রমাণ করার সুযোগ দেয়।

  • জাভা: CEL Java Verifier ( dev.cel:verifier এবং dev.cel:verifier-cli )-এর মাধ্যমে সমর্থিত। এর সক্ষমতাগুলোর মধ্যে রয়েছে উইটনেস ইনপুট জেনারেশন সহ স্যাটিসফায়াবিলিটি ( isSatisfiable ), কাউন্টারএক্সাম্পল জেনারেশন সহ ভ্যালিডিটি ( isAlwaysTrue ), কম্প্রিহেনশনের জন্য বাউন্ডেড মডেল চেকিং (BMC), AST জুড়ে লজিক্যাল ইকুইভ্যালেন্স প্রুফ, এবং কাস্টম assume / assert পলিসি ইনভেরিয়েন্ট ভেরিফিকেশন।
  • Go / C++ / Python / C: জাভা কমান্ড লাইন টুলচেইনের মাধ্যমে পরোক্ষভাবে সমর্থিত।

ভূমিকা এবং বাস্তব-জগতের উদাহরণের জন্য, গুগল ওপেন সোর্স ব্লগ পোস্টটি দেখুন: Securing the agentic era: Introducing formal verification for CEL

,

এই ডকুমেন্টটি কমন এক্সপ্রেশন ল্যাঙ্গুয়েজ (CEL)-এর জন্য একটি সমন্বিত এপিআই ডক রেফারেন্স হিসেবে কাজ করে। এতে অফিসিয়াল CEL স্ট্যাক জুড়ে সমস্ত ম্যাক্রো, অপারেটর এবং স্ট্যান্ডার্ড ফাংশনগুলোর সিগনেচার, আচরণ এবং সাপোর্ট স্ট্যাটাস উল্লেখ করা হয়েছে।

ভাষার আচরণ ও নির্দিষ্টকরণ সম্পর্কে আরও বিশদ তথ্যের জন্য, CEL ভাষার সংজ্ঞা দেখুন।

স্ট্যাক সংস্করণ

এই রেফারেন্স ডকুমেন্টটি CEL স্ট্যাকের নিম্নলিখিত সংস্করণগুলির উপর ভিত্তি করে তৈরি:

  • CEL Go : v0.32.0 (এবং নতুন সংস্করণ)
  • সেল সি++ : v0.16.1
  • সিইএল জাভা : v0.14.0
  • CEL পাইথন : v0.1.3
  • সিইএল সি : উন্নয়ন স্ন্যাপশট (অপ্রকাশিত)

গিটহাব মিরর

CEL-এর আনুষ্ঠানিক বাস্তবায়নগুলো গিটহাবে cel-expr অর্গানাইজেশনের অধীনে মিরর করা আছে:


১. মূল ম্যাক্রো

এগুলো হলো অন্তর্নির্মিত ম্যাক্রো যা কম্পাইল করার সময় সম্প্রসারিত হয়।

ম্যাক্রো বর্ণনা যান সি++ জাভা পাইথন সি
has(container.field) কোনো মেসেজে একটি ফিল্ড, অথবা একটি ম্যাপের কোনো কী উপস্থিত আছে কিনা তা পরীক্ষা করে।

স্বাক্ষরসমূহ:
has(container.field) -> bool

উদাহরণ:
has(request.auth.claims.email)
list.all(var, predicate) একটি তালিকার সমস্ত উপাদান একটি শর্ত পূরণ করে কিনা তা পরীক্ষা করে।

স্বাক্ষরসমূহ:
list.all(var, predicate) -> bool

উদাহরণ:
[1, 2, 3].all(x, x > 0) // true
¹
list.exists(var, predicate) একটি তালিকার অন্তত একটি উপাদান কোনো শর্ত পূরণ করে কি না, তা পরীক্ষা করে।

স্বাক্ষরসমূহ:
list.exists(var, predicate) -> bool

উদাহরণ:
[1, 2, 3].exists(x, x > 2) // true
¹
list.exists_one(var, predicate) একটি তালিকার ঠিক একটি উপাদান কোনো শর্ত পূরণ করে কি না, তা পরীক্ষা করে।

স্বাক্ষরসমূহ:
list.exists_one(var, predicate) -> bool

উদাহরণ:
[1, 2, 3].exists_one(x, x == 2) // true
¹
list.filter(var, predicate) একটি প্রেডিকেট অনুসারে তালিকার উপাদানগুলোকে ফিল্টার করে।

স্বাক্ষরসমূহ:
list.filter(var, predicate) -> list

উদাহরণ:
[1, 2, 3].filter(x, x > 1) // [2, 3]
¹
list.map(var, transform) একটি এক্সপ্রেশন ব্যবহার করে তালিকার প্রতিটি উপাদানকে রূপান্তরিত করে।

স্বাক্ষরসমূহ:
list.map(var, transform) -> list

উদাহরণ:
[1, 2, 3].map(x, x * 2) // [2, 4, 6]
¹
list.map(var, filter, transform) তালিকার সেই উপাদানগুলোকে রূপান্তরিত করে যেগুলো একটি ফিল্টার প্রেডিকেট পূরণ করে।

স্বাক্ষরসমূহ:
list.map(var, filter, transform) -> list

উদাহরণ:
[1, 2, 3].map(x, x > 1, x * 2) // [4, 6]
¹

¹ সি রানটাইমে সমর্থিত, কারণ হোস্ট কম্পাইলার দ্বারা কম্পাইলেশনের সময় ম্যাক্রোগুলো কম্প্রিহেনশনে প্রসারিত হয়।


২. মূল অপারেটররা

অপারেটর বর্ণনা যান সি++ জাভা পাইথন সি
পাটিগণিত ( + , - , * , / , % ) সাধারণ গাণিতিক প্রক্রিয়া। নেগেশন ( -x ) এবং আইডেন্টিটি ( +x )। লিস্ট কনক্যাটেনেশন ( list + list ) Go, C++, Java, এবং Python-এ সমর্থিত।

স্বাক্ষরসমূহ:
T + T -> T
T - T -> T
T * T -> T
T / T -> T
T % T -> T
-T -> T
+T -> T
list + list -> list

উদাহরণ:
1 + 2 * 3 // 7
[1] + [2] // [1, 2]
²
তুলনা ( == , != , < , <= , > , >= ) সাধারণ তুলনা। সংখ্যাসূচক তুলনাগুলো ভিন্নধর্মী হয় (যেমন 1 == 1.0 )।

স্বাক্ষরসমূহ:
T == T -> bool
T != T -> bool
T < T -> bool
T <= T -> bool
T > T -> bool
T >= T -> bool

উদাহরণ:
x < 42.0
1 == 1.0 // true
যৌক্তিক ( ! , && , || , ? : :) লজিক্যাল NOT, AND, OR, এবং টারনারি কন্ডিশনাল। AND/OR শর্ট-সার্কিট ইভ্যালুয়েশন ব্যবহার করে।

স্বাক্ষরসমূহ:
!bool -> bool
bool && bool -> bool
bool || bool -> bool
bool ? T : T -> T

উদাহরণ:
x > 0 ? "positive" : "non-positive"
সূচীকরণ ( [] ) ইনডেক্স ব্যবহার করে লিস্টের এলিমেন্ট অ্যাক্সেস করুন, অথবা ম্যাপে লুকআপ কী ব্যবহার করুন।

স্বাক্ষরসমূহ:
list[int] -> T
map[K] -> V

উদাহরণ:
tags[0]
users['john']
সদস্যপদ ( in ) এলিমেন্টটি কোনো লিস্টে আছে কিনা, অথবা কী-টি কোনো ম্যাপে আছে কিনা তা যাচাই করুন।

স্বাক্ষরসমূহ:
T in list -> bool
K in map -> bool

উদাহরণ:
'admin' in roles

² সি রানটাইমে লিস্ট সংযোজন ( list + list ) সমর্থিত নয় , যদিও অন্যান্য গাণিতিক অপারেটর সমর্থিত।


৩. মূল কার্যাবলী

সাধারণ ও স্ট্রিং ফাংশন

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
size একটি স্ট্রিং (ক্যারেক্টার), বাইট, লিস্ট বা ম্যাপের সাইজ রিটার্ন করে।

স্বাক্ষরসমূহ:
size(T) -> int (যেখানে T হলো string , bytes , list , বা map )

উদাহরণ:
size("hello") // 5
contains স্ট্রিংটিতে কোনো সাবস্ট্রিং আছে কিনা তা ফেরত দেয়।

স্বাক্ষরসমূহ:
string.contains(string) -> bool

উদাহরণ:
"hello".contains("ell") // true
startsWith স্ট্রিংটি কোনো প্রিফিক্স দিয়ে শুরু হয় কিনা তা ফেরত দেয়।

স্বাক্ষরসমূহ:
string.startsWith(string) -> bool

উদাহরণ:
"hello".startsWith("he") // true
endsWith স্ট্রিংটি সাফিক্স সহ শেষ হয় কিনা তা ফেরত দেয়।

স্বাক্ষরসমূহ:
string.endsWith(string) -> bool

উদাহরণ:
"hello".endsWith("lo") // true
matches স্ট্রিংটি RE2 রেগুলার এক্সপ্রেশনের সাথে মেলে কিনা তা ফেরত দেয়।

স্বাক্ষরসমূহ:
string.matches(string) -> bool

উদাহরণ:
"123".matches(r"^\d+$") // true

তারিখ এবং সময় নির্বাচক ফাংশন

এই ফাংশনগুলো google.protobuf.Timestamp অথবা google.protobuf.Duration থেকে উপাদানগুলো নিষ্কাশন করে।

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
getFullYear চার-অঙ্কের বছরটি ফেরত দেয়।

স্বাক্ষরসমূহ:
timestamp.getFullYear([tz]) -> int

উদাহরণ:
timestamp("2026-07-23T00:00:00Z").getFullYear() // 2026
getMonth মাসটি (০-১১) ফেরত দেয়।

স্বাক্ষরসমূহ:
timestamp.getMonth([tz]) -> int

উদাহরণ:
timestamp("2026-07-23T00:00:00Z").getMonth() // 6
getDayOfMonth মাসের দিনটি (১-৩১) দেখায়।

স্বাক্ষরসমূহ:
timestamp.getDayOfMonth([tz]) -> int

উদাহরণ:
timestamp("2026-07-23T00:00:00Z").getDayOfMonth() // 23
getDayOfWeek সপ্তাহের দিনটি জানায় (০ = রবিবার)।

স্বাক্ষরসমূহ:
timestamp.getDayOfWeek([tz]) -> int

উদাহরণ:
timestamp("2026-07-23T00:00:00Z").getDayOfWeek() // 4
getDayOfYear বছরের দিনটি (০-৩৬৫) জানায়।

স্বাক্ষরসমূহ:
timestamp.getDayOfYear([tz]) -> int

উদাহরণ:
timestamp("2026-07-23T00:00:00Z").getDayOfYear() // 203
getHours ঘন্টা (০-২৩) ফেরত দেয়।

স্বাক্ষরসমূহ:
timestamp.getHours([tz]) -> int
duration.getHours() -> int

উদাহরণ:
duration("1h30m").getHours() // 1
getMinutes মিনিট (০-৫৯) ফেরত দেয়।

স্বাক্ষরসমূহ:
timestamp.getMinutes([tz]) -> int
duration.getMinutes() -> int

উদাহরণ:
duration("1h30m").getMinutes() // 30
getSeconds সেকেন্ডে (০-৫৯) ফেরত দেয়।

স্বাক্ষরসমূহ:
timestamp.getSeconds([tz]) -> int
duration.getSeconds() -> int

উদাহরণ:
duration("1h30m45s").getSeconds() // 45
getMilliseconds মিলিসেকেন্ডে (০-৯৯৯) ফেরত দেয়।

স্বাক্ষরসমূহ:
timestamp.getMilliseconds([tz]) -> int
duration.getMilliseconds() -> int

উদাহরণ:
duration("1.5s").getMilliseconds() // 500

টাইপ রূপান্তর

লক্ষ্য প্রকার বর্ণনা যান সি++ জাভা পাইথন সি
bool বুলিয়ানে রূপান্তর করে।

স্বাক্ষরসমূহ:
bool(bool) -> bool
bool(string) -> bool

উদাহরণ:
bool("true") // true
bytes বাইটে রূপান্তর করে।

স্বাক্ষরসমূহ:
bytes(bytes) -> bytes
bytes(string) -> bytes

উদাহরণ:
bytes("hello") // b"hello"
double ডাবল-প্রিসিশন ফ্লোটে রূপান্তর করে।

স্বাক্ষরসমূহ:
double(double) -> double
double(int) -> double
double(uint) -> double
double(string) -> double

উদাহরণ:
double(1) // 1.0
duration সময়কালে রূপান্তরিত করে।

স্বাক্ষরসমূহ:
duration(duration) -> duration
duration(string) -> duration

উদাহরণ:
duration("1.5s") // 1.5s duration
int ৬৪-বিট স্বাক্ষরিত পূর্ণসংখ্যায় রূপান্তর করে।

স্বাক্ষরসমূহ:
int(int) -> int
int(uint) -> int
int(double) -> int (শূন্যে রাউন্ড হয়)
int(string) -> int
int(timestamp) -> int (ইপক থেকে সেকেন্ড)

উদাহরণ:
int(1.5) // 1
string স্ট্রিং-এ রূপান্তর করে।

স্বাক্ষরসমূহ:
string(T) -> string (যা bool , int , uint , double , bytes , timestamp , duration সমর্থন করে)

উদাহরণ:
string(1.5) // "1.5"
timestamp টাইমস্ট্যাম্পে রূপান্তর করে।

স্বাক্ষরসমূহ:
timestamp(timestamp) -> timestamp
timestamp(string) -> timestamp (RFC3339)

উদাহরণ:
timestamp("2026-07-23T00:00:00Z")
uint ৬৪-বিটের অচিহ্নিত পূর্ণসংখ্যায় রূপান্তর করে।

স্বাক্ষরসমূহ:
uint(uint) -> uint
uint(int) -> uint
uint(double) -> uint
uint(string) -> uint

উদাহরণ:
uint(1) // 1u
dyn টাইপ-চেকিংয়ের জন্য ভ্যালুকে ডাইনামিক টাইপে রূপান্তর করে।

স্বাক্ষরসমূহ:
dyn(T) -> dyn

উদাহরণ:
dyn([1, "two"])
type মানটির ধরন ফেরত দেয়।

স্বাক্ষরসমূহ:
type(T) -> type

উদাহরণ:
type(1) // int

৪. এক্সটেনশন (লাইব্রেরি)

বাইন্ডিং লাইব্রেরি

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
cel.bind ডুপ্লিকেট ইভ্যালুয়েশন এড়ানোর জন্য একটি লোকাল ভেরিয়েবল বাইন্ড করে।

স্বাক্ষরসমূহ:
cel.bind(varName, initExpr, resultExpr) -> T

উদাহরণ:
cel.bind(x, a + b, x * x)
(v0.15.0) (v0.10.0) (v0.2.0) (v0.1.1)

কীভাবে সক্রিয় করবেন

  • যান: cel.NewEnv() ext.Bindings() ) পাস করুন।
  • C++: CompilerBuilderBindingsCompilerLibrary() যোগ করুন। (রানটাইম স্বয়ংক্রিয়ভাবে পরিচালিত হয়)।
  • জাভা: CelCompiler এবং CelRuntime বিল্ডারগুলিতে CelExtensions.bindings() যোগ করুন।
  • পাইথন: cel_expr_python.ext.ext_bindings ইম্পোর্ট করুন এবং cel.NewEnv(extensions=[...]) -এ ExtBindings() ব্যবহার করুন।

এনকোডার লাইব্রেরি

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
base64.encode বাইটগুলিকে বেস৬৪ স্ট্রিং-এ এনকোড করে।

স্বাক্ষরসমূহ:
base64.encode(bytes) -> string

উদাহরণ:
base64.encode(b"hello") // "aGVsbG8="
(v0.6.0) (v0.10.0) (v0.2.0) (v0.1.1)
base64.decode বেস৬৪ স্ট্রিংকে বাইটে ডিকোড করে। ভুল ইনপুট দিলে ত্রুটি দেখায়।

স্বাক্ষরসমূহ:
base64.decode(string) -> bytes

উদাহরণ:
base64.decode("aGVsbG8=") // b"hello"
(v0.6.0) (v0.10.0) (v0.2.0) (v0.1.1)
json.encode একটি CEL মানকে JSON স্ট্রিং-এ সিরিয়ালাইজ করে।

স্বাক্ষরসমূহ:
json.encode(dyn) -> string

উদাহরণ:
json.encode([1, 2]) // "[1,2]"
(v0.29.0)

কীভাবে সক্রিয় করবেন

  • যান: ext.Encoders() কে cel.NewEnv() -এ পাস করুন।
  • সি++:
  • জাভা: CelCompiler এবং CelRuntime বিল্ডারগুলিতে CelExtensions.encoders() যোগ করুন।
  • পাইথন: cel_expr_python.ext.ext_encoders ইম্পোর্ট করুন এবং cel.NewEnv(extensions=[...]) -এ ExtEncoders() ব্যবহার করুন।

গণিত গ্রন্থাগার

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
math.greatest সংখ্যাসূচক আর্গুমেন্টগুলোর (বা সংখ্যাসূচক সংখ্যার তালিকার) মধ্যে বৃহত্তমটি ফেরত দেয়।

স্বাক্ষরসমূহ:
math.greatest(arg, ...) -> T

উদাহরণ:
math.greatest(1, 3, 2) // 3
(v0.13.0) (v0.10.0) (v0.2.0) (v0.1.1)
math.least সংখ্যাসূচক আর্গুমেন্টগুলোর (বা সংখ্যাসূচক সংখ্যার তালিকার) মধ্যে সর্বনিম্ন মানটি ফেরত দেয়।

স্বাক্ষরসমূহ:
math.least(arg, ...) -> T

উদাহরণ:
math.least([1, 3, 2]) // 1
(v0.13.0) (v0.10.0) (v0.2.0) (v0.1.1)
math.abs পরম মান।

স্বাক্ষরসমূহ:
math.abs(T) -> T ( int , uint , double সমর্থন করে)

উদাহরণ:
math.abs(-1) // 1
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.sqrt বর্গমূল।

স্বাক্ষরসমূহ:
math.sqrt(T) -> double ( int , uint , double সমর্থন করে)

উদাহরণ:
math.sqrt(9) // 3.0
(v0.25.1) (v0.12.0) (v0.11.0) (v0.1.1)
math.bitAnd বিটওয়াইজ AND।

স্বাক্ষরসমূহ:
math.bitAnd(T, T) -> T ( int , uint সমর্থন করে)

উদাহরণ:
math.bitAnd(5, 3) // 1
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.bitOr বিটওয়াইজ OR।

স্বাক্ষরসমূহ:
math.bitOr(T, T) -> T ( int , uint সমর্থন করে)

উদাহরণ:
math.bitOr(5, 3) // 7
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.bitXor বিটওয়াইজ XOR।

স্বাক্ষরসমূহ:
math.bitXor(T, T) -> T ( int , uint সমর্থন করে)

উদাহরণ:
math.bitXor(5, 3) // 6
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.bitNot বিটওয়াইজ নয়।

স্বাক্ষরসমূহ:
math.bitNot(T) -> T ( int , uint সমর্থন করে)

উদাহরণ:
math.bitNot(1) // -2
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.bitShiftLeft বিটওয়াইজ বামে সরান।

স্বাক্ষরসমূহ:
math.bitShiftLeft(T, int) -> T ( int , uint সমর্থন করে)

উদাহরণ:
math.bitShiftLeft(1, 2) // 4
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.bitShiftRight বিটওয়াইজ শিফট রাইট।

স্বাক্ষরসমূহ:
math.bitShiftRight(T, int) -> T ( int , uint সমর্থন করে)

উদাহরণ:
math.bitShiftRight(4, 2) // 1
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.ceil ছাদ গোলাকার করা।

স্বাক্ষরসমূহ:
math.ceil(double) -> double

উদাহরণ:
math.ceil(1.2) // 2.0
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.floor মেঝে গোলাকার করা।

স্বাক্ষরসমূহ:
math.floor(double) -> double

উদাহরণ:
math.floor(1.8) // 1.0
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.round নিকটতম পূর্ণসংখ্যায় রাউন্ডিং।

স্বাক্ষরসমূহ:
math.round(double) -> double

উদাহরণ:
math.round(1.5) // 2.0
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.trunc ট্রাঙ্কেশন রাউন্ডিং (শূন্যের দিকে)।

স্বাক্ষরসমূহ:
math.trunc(double) -> double

উদাহরণ:
math.trunc(-1.8) // -1.0
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.isInf ডাবলটি ধনাত্মক না ঋণাত্মক অসীম তা যাচাই করে।

স্বাক্ষরসমূহ:
math.isInf(double) -> bool

উদাহরণ:
math.isInf(1.0/0.0) // true
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.isNaN ডাবলটি NaN কিনা তা যাচাই করে।

স্বাক্ষরসমূহ:
math.isNaN(double) -> bool

উদাহরণ:
math.isNaN(0.0/0.0) // true
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.isFinite ডাবলটি সসীম কিনা তা যাচাই করে।

স্বাক্ষরসমূহ:
math.isFinite(double) -> bool

উদাহরণ:
math.isFinite(1.2) // true
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.sign মানের চিহ্ন (-১, ০, বা ১) ফেরত দেয়।

স্বাক্ষরসমূহ:
math.sign(T) -> T ( int , uint , double সমর্থন করে)

উদাহরণ:
math.sign(-42) // -1
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)

কীভাবে সক্রিয় করবেন

  • যান: cel.NewEnv() ext.Math() পাস করুন।
  • সি++:
  • জাভা: CelCompiler এবং CelRuntime বিল্ডারগুলিতে CelExtensions.math() যোগ করুন।
  • পাইথন: cel_expr_python.ext.ext_math ইম্পোর্ট করুন এবং cel.NewEnv(extensions=[...]) -এ ExtMath() ব্যবহার করুন।

প্রোটোস লাইব্রেরি

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
proto.getExt প্রোটো২ এক্সটেনশন ফিল্ডটি গ্রহণ করে, অথবা সেট করা না থাকলে ডিফল্টটি গ্রহণ করে।

স্বাক্ষরসমূহ:
proto.getExt(msg, extName) -> T

উদাহরণ:
proto.getExt(msg, google.api.expr.test.int32_ext)
(v0.13.0) (v0.10.0) (v0.2.0) (v0.1.1)
proto.hasExt প্রোটো২ এক্সটেনশন ফিল্ড সেট করা আছে কিনা তা যাচাই করে।

স্বাক্ষরসমূহ:
proto.hasExt(msg, extName) -> bool

উদাহরণ:
proto.hasExt(msg, google.api.expr.test.int32_ext)
(v0.13.0) (v0.10.0) (v0.2.0) (v0.1.1)

কীভাবে সক্রিয় করবেন

  • যান: cel.NewEnv() ext.Protos() ) পাস করুন।
  • C++: CompilerBuilderProtoExtCompilerLibrary() যোগ করুন। (রানটাইম স্বয়ংক্রিয়ভাবে পরিচালিত হয়)।
  • জাভা: CelCompiler এবং CelRuntime বিল্ডারগুলিতে CelExtensions.protos() যোগ করুন।
  • পাইথন: cel_expr_python.ext.ext_proto ইম্পোর্ট করুন এবং cel.NewEnv(extensions=[...]) -এ ExtProto() ব্যবহার করুন।

তালিকা লাইব্রেরি

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
distinct স্বতন্ত্র উপাদানগুলো ফেরত দেয়।

স্বাক্ষরসমূহ:
list.distinct() -> list

উদাহরণ:
[1, 2, 2].distinct() // [1, 2]
(v0.22.0) (v0.11.0) (v0.11.0) (v0.1.1)
flatten নেস্টেড লিস্টকে ফ্ল্যাট করে।

স্বাক্ষরসমূহ:
list.flatten([depth]) -> list

উদাহরণ:
[[1], [2, 3]].flatten() // [1, 2, 3]
(v0.22.0) (v0.11.0) (v0.7.1) (v0.1.1)
lists.range [0, ..., n-1] পূর্ণসংখ্যার একটি তালিকা ফেরত দেয়।

স্বাক্ষরসমূহ:
lists.range(int) -> list(int)

উদাহরণ:
lists.range(3) // [0, 1, 2]
(v0.22.0) (v0.11.0) (v0.10.1) (v0.1.1)
reverse Reverses the list.

Signatures:
list.reverse() -> list

Examples:
[1, 2].reverse() // [2, 1]
(v0.22.0) (v0.11.0) (v0.11.0) (v0.1.1)
slice Returns sub-list (start inclusive, end exclusive).

Signatures:
list.slice(start, end) -> list

Examples:
[1, 2, 3].slice(1, 3) // [2, 3]
(v0.17.0) (v0.11.0) (v0.11.0) (v0.1.1)
sort Sorts list of comparable elements.

Signatures:
list.sort() -> list

Examples:
[3, 1, 2].sort() // [1, 2, 3]
(v0.22.0) (v0.11.0) (v0.11.0) (v0.1.1)
sortBy Sorts list by key evaluated from expression.

Signatures:
list.sortBy(var, expr) -> list

Examples:
[{"val": 2}, {"val": 1}].sortBy(x, x.val) // [{"val": 1}, {"val": 2}]
(v0.22.0) (v0.11.0) (v0.11.0) (v0.1.1)
first Returns first element as optional. Requires the Optional extension.

Signatures:
list.first() -> optional

Examples:
[1, 2].first() // optional(1)
(v0.23.0) (v0.15.0) (v0.11.0) (v0.1.2)
last Returns last element as optional. Requires the Optional extension.

Signatures:
list.last() -> optional

Examples:
[1, 2].last() // optional(2)
(v0.23.0) (v0.15.0) (v0.11.0) (v0.1.2)

How to Enable

Sets Library

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
sets.contains Checks if list1 contains all elements of list2.

Signatures:
sets.contains(list1, list2) -> bool

Examples:
sets.contains([1, 2], [1]) // true
(v0.15.0) (v0.10.0) (v0.6.0) (v0.1.1)
sets.equivalent Checks if lists are set-equivalent (contain same unique elements).

Signatures:
sets.equivalent(list1, list2) -> bool

উদাহরণ:
sets.equivalent([1, 2], [2, 1, 1]) // true
(v0.15.0) (v0.10.0) (v0.6.0) (v0.1.1)
sets.intersects Checks if lists share at least one element.

Signatures:
sets.intersects(list1, list2) -> bool

Examples:
sets.intersects([1, 2], [2, 3]) // true
(v0.15.0) (v0.10.0) (v0.6.0) (v0.1.1)

How to Enable

Strings Library

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
charAt Returns character at index.

Signatures:
string.charAt(int) -> string

Examples:
"hello".charAt(1) // "e"
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
indexOf Returns index of first occurrence of substring, or -1.

Signatures:
string.indexOf(substr, [start]) -> int

Examples:
"hello".indexOf("l") // 2
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
lastIndexOf Returns index of last occurrence of substring, or -1.

Signatures:
string.lastIndexOf(substr, [end]) -> int

Examples:
"hello".lastIndexOf("l") // 3
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
join Concatenates strings.

Signatures:
list(string).join([separator]) -> string

Examples:
["a", "b"].join("-") // "ab"
(v0.10.0) (v0.10.0) (v0.2.0) (v0.1.1)
split Splits string by separator.

Signatures:
string.split(separator, [limit]) -> list(string)

Examples:
"ab".split("-") // ["a", "b"]
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
substring Returns substring (start inclusive, end exclusive).

Signatures:
string.substring(start, [end]) -> string

Examples:
"hello".substring(1, 3) // "el"
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
trim Trims Unicode whitespace.

Signatures:
string.trim() -> string

Examples:
" hello ".trim() // "hello"
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
replace Replaces occurrences of old with new.

Signatures:
string.replace(old, new, [limit]) -> string

Examples:
"hello".replace("l", "w") // "hewwo"
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
reverse Reverses Unicode code points.

Signatures:
string.reverse() -> string

Examples:
"abc".reverse() // "cba"
(v0.18.0) (v0.14.0) (v0.13.0) (v0.1.1)
lowerAscii Converts ASCII characters to lowercase.

Signatures:
string.lowerAscii() -> string

Examples:
"Hello".lowerAscii() // "hello"
(v0.6.0) (v0.11.0) (v0.2.0) (v0.1.1)
upperAscii Converts ASCII characters to uppercase.

Signatures:
string.upperAscii() -> string

Examples:
"Hello".upperAscii() // "HELLO"
(v0.6.0) (v0.11.0) (v0.2.0) (v0.1.1)
quote Escapes string for safe printing.

Signatures:
strings.quote(string) -> string

Examples:
strings.quote("a\tb") // "\"a\\tb\""
(v0.14.0) (v0.14.0) (v0.13.0) (v0.1.1)
format Formats the string using printf-style placeholders.

Signatures:
string.format(list) -> string

Examples:
"str: %s, int: %d".format(["a", 1]) // "str: a, int: 1"
(v0.14.0) (v0.11.0) (v0.1.1)

How to Enable

Regular Expression Library

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
regex.replace Replaces matches with replacement string (supports backreferences).

Signatures:
regex.replace(target, pat, repl, [limit]) -> string

উদাহরণ:
regex.replace("123-456", r"(\d+)-(\d+)", r"\2-\1") // "456-123"
(v0.25.1) (v0.13.0) (v0.10.1) (v0.1.1)
regex.extract Returns first match of pattern (must have one capture group).

Signatures:
regex.extract(target, pat) -> optional(string)

Examples:
regex.extract("a123b", r"(\d+)") // optional("123")
(v0.25.1) (v0.13.0) (v0.10.1) (v0.1.1)
regex.extractAll Returns all matches of pattern (must have one capture group).

Signatures:
regex.extractAll(target, pat) -> list(string)

Examples:
regex.extractAll("a1b2", r"(\d+)") // ["1", "2"]
(v0.25.1) (v0.13.0) (v0.10.1) (v0.1.1)

How to Enable

Two-Variable Comprehensions

ম্যাক্রো বর্ণনা যান সি++ জাভা পাইথন সি
all Short-circuiting logical AND over key/index and value.

Signatures:
list.all(i, v, pred) -> bool
map.all(k, v, pred) -> bool

Examples:
[1, 2].all(i, v, v > 0) // true
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)
exists Short-circuiting logical OR over key/index and value.

Signatures:
list.exists(i, v, pred) -> bool
map.exists(k, v, pred) -> bool

Examples:
[1, 2].exists(i, v, v == 2) // true
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)
existsOne Checks if exactly one pair satisfies predicate.

Signatures:
list.existsOne(i, v, pred) -> bool
map.existsOne(k, v, pred) -> bool

Examples:
[1, 2].existsOne(i, v, v == 2) // true
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)
transformList Transforms/filters list/map into a list.

Signatures:
list.transformList(i, v, [filter], transform) -> list
map.transformList(k, v, [filter], transform) -> list

Examples:
[1, 2].transformList(i, v, v * 2) // [2, 4]
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)
transformMap Transforms values of list/map into a map (keys remain fixed).

Signatures:
list.transformMap(i, v, [filter], transform) -> map
map.transformMap(k, v, [filter], transform) -> map

Examples:
[1, 2].transformMap(i, v, v * 2) // {0: 2, 1: 4}
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)
transformMapEntry Transforms into a map.

Signatures:
list.transformMapEntry(i, v, [filter], transform_entry) -> map
map.transformMapEntry(k, v, [filter], transform_entry) -> map

Examples:
[1, 2].transformMapEntry(i, v, {string(v): v * 2}) // {"1": 2, "2": 4}
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)

How to Enable

Native Types Library

বৈশিষ্ট্য বর্ণনা যান সি++ জাভা পাইথন সি
Native Structs Registering and instantiating host native types (Go structs / Java POJOs) in CEL.

Examples:
Account{id: 123} (Java POJO instanced in CEL)
(v0.13.0) (v0.13.0)

How to Enable

Network Library

The Network library provides functions for parsing, validating, and manipulating IP addresses and CIDR blocks.

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
ip Parses a string into an IP address, or extracts the IP from a CIDR.

Signatures:
ip(string) -> IP
CIDR.ip() -> IP

Examples:
ip("192.168.0.1")
cidr("192.168.0.0/24").ip()
(v0.29.0)
isIP Checks if a string is a valid IP address.

Signatures:
isIP(string) -> bool

Examples:
isIP("192.168.0.1") // true
(v0.29.0)
ip.isCanonical Checks if an IP address string is in its canonical format.

Signatures:
ip.isCanonical(string) -> bool

Examples:
ip.isCanonical("192.168.0.1") // true
(v0.29.0)
cidr Parses a string into a CIDR block.

Signatures:
cidr(string) -> CIDR

Examples:
cidr("192.168.0.0/24")
(v0.29.0)
isCIDR Checks if a string is a valid CIDR block.

Signatures:
isCIDR(string) -> bool

Examples:
isCIDR("192.168.0.0/24") // true
(v0.29.0)
containsIP Checks if a CIDR block contains an IP address.

Signatures:
CIDR.containsIP(IP) -> bool
CIDR.containsIP(string) -> bool

Examples:
cidr("192.168.0.0/24").containsIP(ip("192.168.0.1")) // true
(v0.29.0)
containsCIDR Checks if a CIDR block contains another CIDR block.

Signatures:
CIDR.containsCIDR(CIDR) -> bool
CIDR.containsCIDR(string) -> bool

Examples:
cidr("192.168.0.0/16").containsCIDR(cidr("192.168.1.0/24")) // true
(v0.29.0)
family Returns the IP family (4 for IPv4, 6 for IPv6).

Signatures:
IP.family() -> int

Examples:
ip("192.168.0.1").family() // 4
(v0.29.0)
isGlobalUnicast Checks if the IP is a global unicast address.

Signatures:
IP.isGlobalUnicast() -> bool

Examples:
ip("192.168.0.1").isGlobalUnicast() // true
(v0.29.0)
isLinkLocalMulticast Checks if the IP is a link-local multicast address.

Signatures:
IP.isLinkLocalMulticast() -> bool

Examples:
ip("224.0.0.1").isLinkLocalMulticast() // true
(v0.29.0)
isLinkLocalUnicast Checks if the IP is a link-local unicast address.

Signatures:
IP.isLinkLocalUnicast() -> bool

Examples:
ip("169.254.0.1").isLinkLocalUnicast() // true
(v0.29.0)
isLoopback Checks if the IP is a loopback address.

Signatures:
IP.isLoopback() -> bool

Examples:
ip("127.0.0.1").isLoopback() // true
(v0.29.0)
isMask Checks if the CIDR is a valid subnet mask.

Signatures:
CIDR.isMask() -> bool

Examples:
cidr("255.255.255.0/24").isMask() // true
(v0.29.0)
isUnspecified Checks if the IP is an unspecified address (eg 0.0.0.0 ).

Signatures:
IP.isUnspecified() -> bool

Examples:
ip("0.0.0.0").isUnspecified() // true
(v0.29.0)
masked Returns the masked CIDR block.

Signatures:
CIDR.masked() -> CIDR

Examples:
cidr("192.168.0.1/24").masked() // 192.168.0.0/24
(v0.29.0)
prefixLength Returns the prefix length of the CIDR block.

Signatures:
CIDR.prefixLength() -> int

Examples:
cidr("192.168.0.0/24").prefixLength() // 24
(v0.29.0)
string Converts IP or CIDR to string.

Signatures:
string(IP) -> string
string(CIDR) -> string

Examples:
string(ip("192.168.0.1")) // "192.168.0.1"
(v0.29.0)

How to Enable

  • Go: Pass ext.Network() to cel.NewEnv() .
  • C++: Not supported.
  • Java: Not supported.
  • Python: Not supported.

JWT Library

The JWT library provides data types and helper functions for parsing JSON Web Tokens (JWT) and inspecting standard and custom claims.

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
jwt.parse Parses a raw token string into a structured jwt.Token wrapped in an optional.

Signatures:
jwt.parse(string) -> optional(jwt.Token)

Examples:
jwt.parse(token_string).hasValue()
(v0.32.0)
claim Queries a custom claim value by key name from the token payload.

Signatures:
jwt.Token.claim(string) -> optional(dyn)
optional(jwt.Token).claim(string) -> optional(dyn)

Examples:
jwt.parse(token).claim("tenant").orValue("")
(v0.32.0)
presentedBy Validates that the token's issuer and audience match expected values.

Signatures:
jwt.Token.presentedBy(string, string) -> bool
optional(jwt.Token).presentedBy(string, string) -> bool

Examples:
jwt.parse(token).presentedBy("https://auth.example.com", "https://api.example.com")
(v0.32.0)

How to Enable

  • Go: Import cel.dev/cel-go/ext/security/jwt and pass jwt.Library() to cel.NewEnv() .
  • C++: Not supported.
  • Java: Not supported.
  • Python: Not supported.

HMAC Library

The HMAC library provides cryptographic functions to compute and verify Hash-based Message Authentication Codes (HMAC) over strings and byte sequences.

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
hmac.compute Computes raw HMAC signature bytes using the specified algorithm and secret key.

Signatures:
hmac.compute(string, string|bytes, string|bytes) -> bytes

Examples:
hmac.compute(hmac.SHA256, "secret", "message")
(v0.32.0)
hmac.verify Verifies whether an HMAC signature matches the expected digest.

Signatures:
hmac.verify(string, string|bytes, string|bytes, string|bytes) -> bool

Examples:
hmac.verify(hmac.SHA256, secret, msg, expected_sig) // true
(v0.32.0)

How to Enable

  • Go: Import cel.dev/cel-go/ext/security/hmac and pass hmac.Library() to cel.NewEnv() .
  • C++: Not supported.
  • Java: Not supported.
  • Python: Not supported.

5. Advanced Features

Advanced Features Summary

বৈশিষ্ট্য বর্ণনা যান সি++ জাভা পাইথন সি
Partial Evaluation Evaluate with missing inputs; returns unknowns or a simplified expression. ³
Async Evaluation Non-blocking concurrent execution of extension functions.
AST Validators Static analysis checks on the Checked AST after type-checking.
AST Optimizers AST rewrites (constant folding, inlining, CSE) to improve performance.
CEL Policy Compiler Compiles YAML-based policy structures into standard CEL ASTs.
Formal Verification Proves safety invariants, satisfiability, validity, and AST equivalence. (v0.14.0)

³ Go supports generating a Residual AST (pruned AST). ⁴ C++ and Java support returning UnknownSet / CelUnknownSet at runtime, but do not expose public APIs for residual AST generation. ⁵ Go uses AsyncBinding / AsyncOp returning channels. ⁶ Java uses CelAsyncRuntime returning ListenableFuture .

Partial Evaluation (Unknowns)

Partial evaluation allows evaluating an expression when only a subset of the input variables (arguments) are known. Instead of failing, the evaluation produces a result that indicates what is missing, or a simplified expression.

  • Go: Full support. Allows defining a PartialActivation with patterns of unknown attributes. Evaluation returns a types.Unknown value. Go supports generating a Residual AST ( Env.ResidualAst ) which is a pruned, simplified AST containing only the parts of the expression that could not be evaluated.
  • C++: Supports Unknown values. Unknown attribute patterns are configured via Activation::set_unknown_attribute_patterns . Evaluation returns an UnknownSet . Public API does not currently expose residual AST generation.
  • Java: Supports partial evaluation via PartialVars passed to Program.eval() . Evaluation returns a CelUnknownSet . Public API does not currently expose residual AST generation.
  • Python / C: No native support.

Async Evaluation

Async evaluation allows CEL expressions to call functions that execute asynchronously (eg, making RPCs or database queries) and block evaluation until the results are available, without blocking the main execution thread.

  • Go: Supports asynchronous function overloads via AsyncBinding and AsyncOp . Async functions return a Go channel ( <-chan ref.Val ), and the interpreter manages the concurrent execution and synchronization.
  • Java: Supports async evaluation via CelAsyncRuntime and AsyncProgram . It uses ListenableFuture to represent pending values and automatically drives evaluation to completion as futures resolve.
  • C++ / Python / C: No built-in support.

AST Validators

Validators perform static analysis on the Checked AST after type-checking to enforce domain-specific constraints before the program is executed.

  • Go: Supports ASTValidator interface. Canonical validators include cel.validator.duration , cel.validator.timestamp , cel.validator.matches (regex), cel.validator.homogeneous_literals , and cel.validator.comprehension_nesting_limit .
  • C++: Supports cel::Validator . Canonical validations include AstDepthValidator , ComprehensionNestingLimitValidator , DurationLiteralValidator , HomogeneousLiteralValidator , MatchesValidator , and TimestampLiteralValidator .
  • Java: Supports CelValidator and CelAstValidator . Canonical validators include AstDepthLimitValidator , ComprehensionNestingLimitValidator , DurationLiteralValidator , HomogeneousLiteralValidator , RegexLiteralValidator , and TimestampLiteralValidator .
  • Python / C: No direct support.

AST Optimizers

Optimizers rewrite the AST to improve execution performance. Optimizers fall into one of two categories: static and runtime optimizers. C++, Java, and Go support runtime optimization. CEL Java and Go also support static optimizers.

Typical optimizations include constant folding (pre-evaluating sub-expressions with constant inputs) and common subexpression elimination (CSE).

  • Go: Supports AST folding during compilation/planning.
  • C++: Supports constant folding via the cel::extensions::EnableConstantFolding extension at plan time.
  • Java: Supports CelOptimizer interface. Canonical optimizers include ConstantFoldingOptimizer (which supports pre-order traversal, Protobuf message constant folding, and aggregate or optional pruning), InliningOptimizer , and SubexpressionOptimizer (CSE).
  • Python / C: No direct support.

CEL Policy Compiler

CEL Policy is a YAML-based format for composing multiple CEL expressions together with variables, match blocks, conditional outputs, and nested rules. It is designed for complex policy engines (like Kubernetes Admission Control) where single CEL expressions would become unreadable.

For the formal language definition, syntax, and conformance suite, refer to the CEL Policy Specification .

The Policy Compiler compiles these YAML policies into a single standard CEL AST, meaning they are fully compatible with standard CEL runtimes and inherit all performance and safety guarantees.

  • Go: Supported via Go policy (including aggregate rule evaluation semantics).
  • C++: Supported via C++ policy .
  • Java: Supported via Java policy (including aggregate rule evaluation semantics and shorthand type specifiers in policy configs).
  • Python / C: Not directly supported.

Formal Verification Framework

The Formal Verification framework allows users to mathematically prove safety invariants, logical equivalence, satisfiability, and validity across CEL expressions and structured CEL Policies.

  • Java: Supported via the CEL Java Verifier ( dev.cel:verifier and dev.cel:verifier-cli ). Capabilities include satisfiability ( isSatisfiable ) with witness input generation, validity ( isAlwaysTrue ) with counterexample generation, bounded model checking (BMC) for comprehensions, logical equivalence proofs across ASTs, and custom assume / assert policy invariant verification.
  • Go / C++ / Python / C: Are supported indirectly via the Java command line toolchain.

ভূমিকা এবং বাস্তব-জগতের উদাহরণের জন্য, গুগল ওপেন সোর্স ব্লগ পোস্টটি দেখুন: Securing the agentic era: Introducing formal verification for CEL

,

This document serves as the unified API Doc reference for the Common Expression Language (CEL). It lists all macros, operators, and standard functions, indicating their signatures, behaviors, and support status across the official CEL stacks.

For more details on language behavior and specifications, refer to the CEL Language Definition .

Stack Versions

This reference document is based on the following versions of the CEL stacks:

  • CEL Go : v0.32.0 (and newer)
  • CEL C++ : v0.16.1
  • CEL Java : v0.14.0
  • CEL Python : v0.1.3
  • CEL C : Development snapshot (unreleased)

GitHub Mirrors

The official implementations of CEL are mirrored on GitHub under the cel-expr organization:


1. Core Macros

These are built-in macros that are expanded at compile time.

ম্যাক্রো বর্ণনা যান সি++ জাভা পাইথন সি
has(container.field) Tests whether a field is present in a message, or a key in a map.

Signatures:
has(container.field) -> bool

Examples:
has(request.auth.claims.email)
list.all(var, predicate) Tests whether all elements in a list satisfy a predicate.

Signatures:
list.all(var, predicate) -> bool

Examples:
[1, 2, 3].all(x, x > 0) // true
¹
list.exists(var, predicate) Tests whether at least one element in a list satisfies a predicate.

Signatures:
list.exists(var, predicate) -> bool

Examples:
[1, 2, 3].exists(x, x > 2) // true
¹
list.exists_one(var, predicate) Tests whether exactly one element in a list satisfies a predicate.

Signatures:
list.exists_one(var, predicate) -> bool

Examples:
[1, 2, 3].exists_one(x, x == 2) // true
¹
list.filter(var, predicate) Filters elements of a list according to a predicate.

Signatures:
list.filter(var, predicate) -> list

Examples:
[1, 2, 3].filter(x, x > 1) // [2, 3]
¹
list.map(var, transform) Transforms each element of a list using an expression.

Signatures:
list.map(var, transform) -> list

Examples:
[1, 2, 3].map(x, x * 2) // [2, 4, 6]
¹
list.map(var, filter, transform) Transforms elements of a list that satisfy a filter predicate.

Signatures:
list.map(var, filter, transform) -> list

Examples:
[1, 2, 3].map(x, x > 1, x * 2) // [4, 6]
¹

¹ Supported in C runtime because macros are expanded into comprehensions during compilation by the host compiler.


2. Core Operators

Operator বর্ণনা যান সি++ জাভা পাইথন সি
Arithmetic ( + , - , * , / , % ) Standard arithmetic operations. Negation ( -x ) and Identity ( +x ). List concatenation ( list + list ) is supported in Go, C++, Java, and Python.

Signatures:
T + T -> T
T - T -> T
T * T -> T
T / T -> T
T % T -> T
-T -> T
+T -> T
list + list -> list

Examples:
1 + 2 * 3 // 7
[1] + [2] // [1, 2]
²
Comparison ( == , != , < , <= , > , >= ) Standard comparison. Numeric comparisons are heterogeneous (eg 1 == 1.0 ).

Signatures:
T == T -> bool
T != T -> bool
T < T -> bool
T <= T -> bool
T > T -> bool
T >= T -> bool

Examples:
x < 42.0
1 == 1.0 // true
Logical ( ! , && , || , ? : ) Logical NOT, AND, OR, and Ternary Conditional. AND/OR use short-circuit evaluation.

Signatures:
!bool -> bool
bool && bool -> bool
bool || bool -> bool
bool ? T : T -> T

Examples:
x > 0 ? "positive" : "non-positive"
Indexing ( [] ) Access element of a list by index, or lookup key in a map.

Signatures:
list[int] -> T
map[K] -> V

Examples:
tags[0]
users['john']
Membership ( in ) Check if element is in a list, or key is in a map.

Signatures:
T in list -> bool
K in map -> bool

উদাহরণ:
'admin' in roles

² List concatenation ( list + list ) is not supported in the C runtime, though other arithmetic operators are supported.


3. Core Functions

General & String Functions

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
size Returns the size of a string (characters), bytes, list, or map.

Signatures:
size(T) -> int (where T is string , bytes , list , or map )

উদাহরণ:
size("hello") // 5
contains Returns whether string contains substring.

Signatures:
string.contains(string) -> bool

Examples:
"hello".contains("ell") // true
startsWith Returns whether string starts with prefix.

Signatures:
string.startsWith(string) -> bool

Examples:
"hello".startsWith("he") // true
endsWith Returns whether string ends with suffix.

Signatures:
string.endsWith(string) -> bool

Examples:
"hello".endsWith("lo") // true
matches Returns whether string matches RE2 regular expression.

Signatures:
string.matches(string) -> bool

Examples:
"123".matches(r"^\d+$") // true

Date and Time Selector Functions

These functions extract components from google.protobuf.Timestamp or google.protobuf.Duration .

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
getFullYear Returns the 4-digit year.

Signatures:
timestamp.getFullYear([tz]) -> int

Examples:
timestamp("2026-07-23T00:00:00Z").getFullYear() // 2026
getMonth Returns the month (0-11).

Signatures:
timestamp.getMonth([tz]) -> int

Examples:
timestamp("2026-07-23T00:00:00Z").getMonth() // 6
getDayOfMonth Returns the day of the month (1-31).

Signatures:
timestamp.getDayOfMonth([tz]) -> int

উদাহরণ:
timestamp("2026-07-23T00:00:00Z").getDayOfMonth() // 23
getDayOfWeek Returns the day of the week (0 = Sunday).

Signatures:
timestamp.getDayOfWeek([tz]) -> int

Examples:
timestamp("2026-07-23T00:00:00Z").getDayOfWeek() // 4
getDayOfYear Returns the day of the year (0-365).

Signatures:
timestamp.getDayOfYear([tz]) -> int

Examples:
timestamp("2026-07-23T00:00:00Z").getDayOfYear() // 203
getHours Returns the hours (0-23).

Signatures:
timestamp.getHours([tz]) -> int
duration.getHours() -> int

Examples:
duration("1h30m").getHours() // 1
getMinutes Returns the minutes (0-59).

Signatures:
timestamp.getMinutes([tz]) -> int
duration.getMinutes() -> int

Examples:
duration("1h30m").getMinutes() // 30
getSeconds Returns the seconds (0-59).

Signatures:
timestamp.getSeconds([tz]) -> int
duration.getSeconds() -> int

Examples:
duration("1h30m45s").getSeconds() // 45
getMilliseconds Returns the milliseconds (0-999).

Signatures:
timestamp.getMilliseconds([tz]) -> int
duration.getMilliseconds() -> int

Examples:
duration("1.5s").getMilliseconds() // 500

টাইপ রূপান্তর

Target Type বর্ণনা যান সি++ জাভা পাইথন সি
bool Converts to boolean.

Signatures:
bool(bool) -> bool
bool(string) -> bool

Examples:
bool("true") // true
bytes Converts to bytes.

Signatures:
bytes(bytes) -> bytes
bytes(string) -> bytes

Examples:
bytes("hello") // b"hello"
double Converts to double-precision float.

Signatures:
double(double) -> double
double(int) -> double
double(uint) -> double
double(string) -> double

Examples:
double(1) // 1.0
duration Converts to duration.

Signatures:
duration(duration) -> duration
duration(string) -> duration

Examples:
duration("1.5s") // 1.5s duration
int Converts to 64-bit signed integer.

Signatures:
int(int) -> int
int(uint) -> int
int(double) -> int (rounds to zero)
int(string) -> int
int(timestamp) -> int (seconds since epoch)

Examples:
int(1.5) // 1
string Converts to string.

Signatures:
string(T) -> string (supports bool , int , uint , double , bytes , timestamp , duration )

Examples:
string(1.5) // "1.5"
timestamp Converts to timestamp.

Signatures:
timestamp(timestamp) -> timestamp
timestamp(string) -> timestamp (RFC3339)

Examples:
timestamp("2026-07-23T00:00:00Z")
uint Converts to 64-bit unsigned integer.

Signatures:
uint(uint) -> uint
uint(int) -> uint
uint(double) -> uint
uint(string) -> uint

Examples:
uint(1) // 1u
dyn Casts value to dynamic type for type-checking.

Signatures:
dyn(T) -> dyn

Examples:
dyn([1, "two"])
type Returns the type of the value.

Signatures:
type(T) -> type

Examples:
type(1) // int

4. Extensions (Libraries)

Bindings Library

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
cel.bind Binds a local variable to avoid duplicate evaluation.

Signatures:
cel.bind(varName, initExpr, resultExpr) -> T

Examples:
cel.bind(x, a + b, x * x)
(v0.15.0) (v0.10.0) (v0.2.0) (v0.1.1)

How to Enable

Encoders Library

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
base64.encode Encodes bytes to base64 string.

Signatures:
base64.encode(bytes) -> string

Examples:
base64.encode(b"hello") // "aGVsbG8="
(v0.6.0) (v0.10.0) (v0.2.0) (v0.1.1)
base64.decode Decodes base64 string to bytes. Throws error on invalid input.

Signatures:
base64.decode(string) -> bytes

Examples:
base64.decode("aGVsbG8=") // b"hello"
(v0.6.0) (v0.10.0) (v0.2.0) (v0.1.1)
json.encode Serializes a CEL value to JSON string.

Signatures:
json.encode(dyn) -> string

Examples:
json.encode([1, 2]) // "[1,2]"
(v0.29.0)

How to Enable

Math Library

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
math.greatest Returns greatest of numeric arguments (or list of numerics).

Signatures:
math.greatest(arg, ...) -> T

Examples:
math.greatest(1, 3, 2) // 3
(v0.13.0) (v0.10.0) (v0.2.0) (v0.1.1)
math.least Returns least of numeric arguments (or list of numerics).

Signatures:
math.least(arg, ...) -> T

উদাহরণ:
math.least([1, 3, 2]) // 1
(v0.13.0) (v0.10.0) (v0.2.0) (v0.1.1)
math.abs Absolute value.

Signatures:
math.abs(T) -> T (supports int , uint , double )

Examples:
math.abs(-1) // 1
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.sqrt বর্গমূল।

Signatures:
math.sqrt(T) -> double (supports int , uint , double )

Examples:
math.sqrt(9) // 3.0
(v0.25.1) (v0.12.0) (v0.11.0) (v0.1.1)
math.bitAnd Bitwise AND.

Signatures:
math.bitAnd(T, T) -> T (supports int , uint )

Examples:
math.bitAnd(5, 3) // 1
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.bitOr Bitwise OR.

Signatures:
math.bitOr(T, T) -> T (supports int , uint )

Examples:
math.bitOr(5, 3) // 7
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.bitXor Bitwise XOR.

Signatures:
math.bitXor(T, T) -> T (supports int , uint )

Examples:
math.bitXor(5, 3) // 6
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.bitNot Bitwise NOT.

Signatures:
math.bitNot(T) -> T (supports int , uint )

Examples:
math.bitNot(1) // -2
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.bitShiftLeft Bitwise shift left.

Signatures:
math.bitShiftLeft(T, int) -> T (supports int , uint )

Examples:
math.bitShiftLeft(1, 2) // 4
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.bitShiftRight Bitwise shift right.

Signatures:
math.bitShiftRight(T, int) -> T (supports int , uint )

Examples:
math.bitShiftRight(4, 2) // 1
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.ceil Ceiling rounding.

Signatures:
math.ceil(double) -> double

Examples:
math.ceil(1.2) // 2.0
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.floor Floor rounding.

Signatures:
math.floor(double) -> double

Examples:
math.floor(1.8) // 1.0
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.round Nearest integer rounding.

Signatures:
math.round(double) -> double

Examples:
math.round(1.5) // 2.0
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.trunc Truncation rounding (towards zero).

Signatures:
math.trunc(double) -> double

Examples:
math.trunc(-1.8) // -1.0
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.isInf Checks if double is positive or negative infinity.

Signatures:
math.isInf(double) -> bool

Examples:
math.isInf(1.0/0.0) // true
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.isNaN Checks if double is NaN.

Signatures:
math.isNaN(double) -> bool

Examples:
math.isNaN(0.0/0.0) // true
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.isFinite Checks if double is finite.

Signatures:
math.isFinite(double) -> bool

Examples:
math.isFinite(1.2) // true
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.sign Returns sign of value (-1, 0, or 1).

Signatures:
math.sign(T) -> T (supports int , uint , double )

উদাহরণ:
math.sign(-42) // -1
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)

How to Enable

Protos Library

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
proto.getExt Gets proto2 extension field, or default if unset.

Signatures:
proto.getExt(msg, extName) -> T

Examples:
proto.getExt(msg, google.api.expr.test.int32_ext)
(v0.13.0) (v0.10.0) (v0.2.0) (v0.1.1)
proto.hasExt Checks if proto2 extension field is set.

Signatures:
proto.hasExt(msg, extName) -> bool

Examples:
proto.hasExt(msg, google.api.expr.test.int32_ext)
(v0.13.0) (v0.10.0) (v0.2.0) (v0.1.1)

How to Enable

Lists Library

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
distinct Returns distinct elements.

Signatures:
list.distinct() -> list

Examples:
[1, 2, 2].distinct() // [1, 2]
(v0.22.0) (v0.11.0) (v0.11.0) (v0.1.1)
flatten Flattens nested lists.

Signatures:
list.flatten([depth]) -> list

Examples:
[[1], [2, 3]].flatten() // [1, 2, 3]
(v0.22.0) (v0.11.0) (v0.7.1) (v0.1.1)
lists.range Returns list of integers [0, ..., n-1] .

Signatures:
lists.range(int) -> list(int)

Examples:
lists.range(3) // [0, 1, 2]
(v0.22.0) (v0.11.0) (v0.10.1) (v0.1.1)
reverse Reverses the list.

Signatures:
list.reverse() -> list

Examples:
[1, 2].reverse() // [2, 1]
(v0.22.0) (v0.11.0) (v0.11.0) (v0.1.1)
slice Returns sub-list (start inclusive, end exclusive).

Signatures:
list.slice(start, end) -> list

Examples:
[1, 2, 3].slice(1, 3) // [2, 3]
(v0.17.0) (v0.11.0) (v0.11.0) (v0.1.1)
sort Sorts list of comparable elements.

Signatures:
list.sort() -> list

Examples:
[3, 1, 2].sort() // [1, 2, 3]
(v0.22.0) (v0.11.0) (v0.11.0) (v0.1.1)
sortBy Sorts list by key evaluated from expression.

Signatures:
list.sortBy(var, expr) -> list

Examples:
[{"val": 2}, {"val": 1}].sortBy(x, x.val) // [{"val": 1}, {"val": 2}]
(v0.22.0) (v0.11.0) (v0.11.0) (v0.1.1)
first Returns first element as optional. Requires the Optional extension.

Signatures:
list.first() -> optional

Examples:
[1, 2].first() // optional(1)
(v0.23.0) (v0.15.0) (v0.11.0) (v0.1.2)
last Returns last element as optional. Requires the Optional extension.

Signatures:
list.last() -> optional

Examples:
[1, 2].last() // optional(2)
(v0.23.0) (v0.15.0) (v0.11.0) (v0.1.2)

How to Enable

Sets Library

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
sets.contains Checks if list1 contains all elements of list2.

Signatures:
sets.contains(list1, list2) -> bool

Examples:
sets.contains([1, 2], [1]) // true
(v0.15.0) (v0.10.0) (v0.6.0) (v0.1.1)
sets.equivalent Checks if lists are set-equivalent (contain same unique elements).

Signatures:
sets.equivalent(list1, list2) -> bool

Examples:
sets.equivalent([1, 2], [2, 1, 1]) // true
(v0.15.0) (v0.10.0) (v0.6.0) (v0.1.1)
sets.intersects Checks if lists share at least one element.

Signatures:
sets.intersects(list1, list2) -> bool

Examples:
sets.intersects([1, 2], [2, 3]) // true
(v0.15.0) (v0.10.0) (v0.6.0) (v0.1.1)

How to Enable

Strings Library

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
charAt Returns character at index.

Signatures:
string.charAt(int) -> string

উদাহরণ:
"hello".charAt(1) // "e"
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
indexOf Returns index of first occurrence of substring, or -1.

Signatures:
string.indexOf(substr, [start]) -> int

Examples:
"hello".indexOf("l") // 2
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
lastIndexOf Returns index of last occurrence of substring, or -1.

Signatures:
string.lastIndexOf(substr, [end]) -> int

Examples:
"hello".lastIndexOf("l") // 3
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
join Concatenates strings.

Signatures:
list(string).join([separator]) -> string

Examples:
["a", "b"].join("-") // "ab"
(v0.10.0) (v0.10.0) (v0.2.0) (v0.1.1)
split Splits string by separator.

Signatures:
string.split(separator, [limit]) -> list(string)

Examples:
"ab".split("-") // ["a", "b"]
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
substring Returns substring (start inclusive, end exclusive).

Signatures:
string.substring(start, [end]) -> string

Examples:
"hello".substring(1, 3) // "el"
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
trim Trims Unicode whitespace.

Signatures:
string.trim() -> string

Examples:
" hello ".trim() // "hello"
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
replace Replaces occurrences of old with new.

Signatures:
string.replace(old, new, [limit]) -> string

Examples:
"hello".replace("l", "w") // "hewwo"
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
reverse Reverses Unicode code points.

Signatures:
string.reverse() -> string

Examples:
"abc".reverse() // "cba"
(v0.18.0) (v0.14.0) (v0.13.0) (v0.1.1)
lowerAscii Converts ASCII characters to lowercase.

Signatures:
string.lowerAscii() -> string

Examples:
"Hello".lowerAscii() // "hello"
(v0.6.0) (v0.11.0) (v0.2.0) (v0.1.1)
upperAscii Converts ASCII characters to uppercase.

Signatures:
string.upperAscii() -> string

Examples:
"Hello".upperAscii() // "HELLO"
(v0.6.0) (v0.11.0) (v0.2.0) (v0.1.1)
quote Escapes string for safe printing.

Signatures:
strings.quote(string) -> string

Examples:
strings.quote("a\tb") // "\"a\\tb\""
(v0.14.0) (v0.14.0) (v0.13.0) (v0.1.1)
format Formats the string using printf-style placeholders.

Signatures:
string.format(list) -> string

Examples:
"str: %s, int: %d".format(["a", 1]) // "str: a, int: 1"
(v0.14.0) (v0.11.0) (v0.1.1)

How to Enable

Regular Expression Library

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
regex.replace Replaces matches with replacement string (supports backreferences).

Signatures:
regex.replace(target, pat, repl, [limit]) -> string

Examples:
regex.replace("123-456", r"(\d+)-(\d+)", r"\2-\1") // "456-123"
(v0.25.1) (v0.13.0) (v0.10.1) (v0.1.1)
regex.extract Returns first match of pattern (must have one capture group).

Signatures:
regex.extract(target, pat) -> optional(string)

Examples:
regex.extract("a123b", r"(\d+)") // optional("123")
(v0.25.1) (v0.13.0) (v0.10.1) (v0.1.1)
regex.extractAll Returns all matches of pattern (must have one capture group).

Signatures:
regex.extractAll(target, pat) -> list(string)

Examples:
regex.extractAll("a1b2", r"(\d+)") // ["1", "2"]
(v0.25.1) (v0.13.0) (v0.10.1) (v0.1.1)

How to Enable

Two-Variable Comprehensions

ম্যাক্রো বর্ণনা যান সি++ জাভা পাইথন সি
all Short-circuiting logical AND over key/index and value.

Signatures:
list.all(i, v, pred) -> bool
map.all(k, v, pred) -> bool

Examples:
[1, 2].all(i, v, v > 0) // true
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)
exists Short-circuiting logical OR over key/index and value.

Signatures:
list.exists(i, v, pred) -> bool
map.exists(k, v, pred) -> bool

Examples:
[1, 2].exists(i, v, v == 2) // true
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)
existsOne Checks if exactly one pair satisfies predicate.

Signatures:
list.existsOne(i, v, pred) -> bool
map.existsOne(k, v, pred) -> bool

Examples:
[1, 2].existsOne(i, v, v == 2) // true
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)
transformList Transforms/filters list/map into a list.

Signatures:
list.transformList(i, v, [filter], transform) -> list
map.transformList(k, v, [filter], transform) -> list

উদাহরণ:
[1, 2].transformList(i, v, v * 2) // [2, 4]
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)
transformMap Transforms values of list/map into a map (keys remain fixed).

Signatures:
list.transformMap(i, v, [filter], transform) -> map
map.transformMap(k, v, [filter], transform) -> map

Examples:
[1, 2].transformMap(i, v, v * 2) // {0: 2, 1: 4}
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)
transformMapEntry Transforms into a map.

Signatures:
list.transformMapEntry(i, v, [filter], transform_entry) -> map
map.transformMapEntry(k, v, [filter], transform_entry) -> map

Examples:
[1, 2].transformMapEntry(i, v, {string(v): v * 2}) // {"1": 2, "2": 4}
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)

How to Enable

Native Types Library

বৈশিষ্ট্য বর্ণনা যান সি++ জাভা পাইথন সি
Native Structs Registering and instantiating host native types (Go structs / Java POJOs) in CEL.

Examples:
Account{id: 123} (Java POJO instanced in CEL)
(v0.13.0) (v0.13.0)

How to Enable

Network Library

The Network library provides functions for parsing, validating, and manipulating IP addresses and CIDR blocks.

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
ip Parses a string into an IP address, or extracts the IP from a CIDR.

Signatures:
ip(string) -> IP
CIDR.ip() -> IP

Examples:
ip("192.168.0.1")
cidr("192.168.0.0/24").ip()
(v0.29.0)
isIP Checks if a string is a valid IP address.

Signatures:
isIP(string) -> bool

Examples:
isIP("192.168.0.1") // true
(v0.29.0)
ip.isCanonical Checks if an IP address string is in its canonical format.

Signatures:
ip.isCanonical(string) -> bool

Examples:
ip.isCanonical("192.168.0.1") // true
(v0.29.0)
cidr Parses a string into a CIDR block.

Signatures:
cidr(string) -> CIDR

Examples:
cidr("192.168.0.0/24")
(v0.29.0)
isCIDR Checks if a string is a valid CIDR block.

Signatures:
isCIDR(string) -> bool

Examples:
isCIDR("192.168.0.0/24") // true
(v0.29.0)
containsIP Checks if a CIDR block contains an IP address.

Signatures:
CIDR.containsIP(IP) -> bool
CIDR.containsIP(string) -> bool

Examples:
cidr("192.168.0.0/24").containsIP(ip("192.168.0.1")) // true
(v0.29.0)
containsCIDR Checks if a CIDR block contains another CIDR block.

Signatures:
CIDR.containsCIDR(CIDR) -> bool
CIDR.containsCIDR(string) -> bool

Examples:
cidr("192.168.0.0/16").containsCIDR(cidr("192.168.1.0/24")) // true
(v0.29.0)
family Returns the IP family (4 for IPv4, 6 for IPv6).

Signatures:
IP.family() -> int

Examples:
ip("192.168.0.1").family() // 4
(v0.29.0)
isGlobalUnicast Checks if the IP is a global unicast address.

Signatures:
IP.isGlobalUnicast() -> bool

Examples:
ip("192.168.0.1").isGlobalUnicast() // true
(v0.29.0)
isLinkLocalMulticast Checks if the IP is a link-local multicast address.

Signatures:
IP.isLinkLocalMulticast() -> bool

Examples:
ip("224.0.0.1").isLinkLocalMulticast() // true
(v0.29.0)
isLinkLocalUnicast Checks if the IP is a link-local unicast address.

Signatures:
IP.isLinkLocalUnicast() -> bool

Examples:
ip("169.254.0.1").isLinkLocalUnicast() // true
(v0.29.0)
isLoopback Checks if the IP is a loopback address.

Signatures:
IP.isLoopback() -> bool

Examples:
ip("127.0.0.1").isLoopback() // true
(v0.29.0)
isMask Checks if the CIDR is a valid subnet mask.

Signatures:
CIDR.isMask() -> bool

উদাহরণ:
cidr("255.255.255.0/24").isMask() // true
(v0.29.0)
isUnspecified Checks if the IP is an unspecified address (eg 0.0.0.0 ).

Signatures:
IP.isUnspecified() -> bool

Examples:
ip("0.0.0.0").isUnspecified() // true
(v0.29.0)
masked Returns the masked CIDR block.

Signatures:
CIDR.masked() -> CIDR

Examples:
cidr("192.168.0.1/24").masked() // 192.168.0.0/24
(v0.29.0)
prefixLength Returns the prefix length of the CIDR block.

Signatures:
CIDR.prefixLength() -> int

Examples:
cidr("192.168.0.0/24").prefixLength() // 24
(v0.29.0)
string Converts IP or CIDR to string.

Signatures:
string(IP) -> string
string(CIDR) -> string

Examples:
string(ip("192.168.0.1")) // "192.168.0.1"
(v0.29.0)

How to Enable

  • Go: Pass ext.Network() to cel.NewEnv() .
  • C++: Not supported.
  • Java: Not supported.
  • Python: Not supported.

JWT Library

The JWT library provides data types and helper functions for parsing JSON Web Tokens (JWT) and inspecting standard and custom claims.

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
jwt.parse Parses a raw token string into a structured jwt.Token wrapped in an optional.

Signatures:
jwt.parse(string) -> optional(jwt.Token)

Examples:
jwt.parse(token_string).hasValue()
(v0.32.0)
claim Queries a custom claim value by key name from the token payload.

Signatures:
jwt.Token.claim(string) -> optional(dyn)
optional(jwt.Token).claim(string) -> optional(dyn)

Examples:
jwt.parse(token).claim("tenant").orValue("")
(v0.32.0)
presentedBy Validates that the token's issuer and audience match expected values.

Signatures:
jwt.Token.presentedBy(string, string) -> bool
optional(jwt.Token).presentedBy(string, string) -> bool

Examples:
jwt.parse(token).presentedBy("https://auth.example.com", "https://api.example.com")
(v0.32.0)

How to Enable

  • Go: Import cel.dev/cel-go/ext/security/jwt and pass jwt.Library() to cel.NewEnv() .
  • C++: Not supported.
  • Java: Not supported.
  • Python: Not supported.

HMAC Library

The HMAC library provides cryptographic functions to compute and verify Hash-based Message Authentication Codes (HMAC) over strings and byte sequences.

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
hmac.compute Computes raw HMAC signature bytes using the specified algorithm and secret key.

Signatures:
hmac.compute(string, string|bytes, string|bytes) -> bytes

Examples:
hmac.compute(hmac.SHA256, "secret", "message")
(v0.32.0)
hmac.verify Verifies whether an HMAC signature matches the expected digest.

Signatures:
hmac.verify(string, string|bytes, string|bytes, string|bytes) -> bool

Examples:
hmac.verify(hmac.SHA256, secret, msg, expected_sig) // true
(v0.32.0)

How to Enable

  • Go: Import cel.dev/cel-go/ext/security/hmac and pass hmac.Library() to cel.NewEnv() .
  • C++: Not supported.
  • Java: Not supported.
  • Python: Not supported.

5. Advanced Features

Advanced Features Summary

বৈশিষ্ট্য বর্ণনা যান সি++ জাভা পাইথন সি
Partial Evaluation Evaluate with missing inputs; returns unknowns or a simplified expression. ³
Async Evaluation Non-blocking concurrent execution of extension functions.
AST Validators Static analysis checks on the Checked AST after type-checking.
AST Optimizers AST rewrites (constant folding, inlining, CSE) to improve performance.
CEL Policy Compiler Compiles YAML-based policy structures into standard CEL ASTs.
Formal Verification Proves safety invariants, satisfiability, validity, and AST equivalence. (v0.14.0)

³ Go supports generating a Residual AST (pruned AST). ⁴ C++ and Java support returning UnknownSet / CelUnknownSet at runtime, but do not expose public APIs for residual AST generation. ⁵ Go uses AsyncBinding / AsyncOp returning channels. ⁶ Java uses CelAsyncRuntime returning ListenableFuture .

Partial Evaluation (Unknowns)

Partial evaluation allows evaluating an expression when only a subset of the input variables (arguments) are known. Instead of failing, the evaluation produces a result that indicates what is missing, or a simplified expression.

  • Go: Full support. Allows defining a PartialActivation with patterns of unknown attributes. Evaluation returns a types.Unknown value. Go supports generating a Residual AST ( Env.ResidualAst ) which is a pruned, simplified AST containing only the parts of the expression that could not be evaluated.
  • C++: Supports Unknown values. Unknown attribute patterns are configured via Activation::set_unknown_attribute_patterns . Evaluation returns an UnknownSet . Public API does not currently expose residual AST generation.
  • Java: Supports partial evaluation via PartialVars passed to Program.eval() . Evaluation returns a CelUnknownSet . Public API does not currently expose residual AST generation.
  • Python / C: No native support.

Async Evaluation

Async evaluation allows CEL expressions to call functions that execute asynchronously (eg, making RPCs or database queries) and block evaluation until the results are available, without blocking the main execution thread.

  • Go: Supports asynchronous function overloads via AsyncBinding and AsyncOp . Async functions return a Go channel ( <-chan ref.Val ), and the interpreter manages the concurrent execution and synchronization.
  • Java: Supports async evaluation via CelAsyncRuntime and AsyncProgram . It uses ListenableFuture to represent pending values and automatically drives evaluation to completion as futures resolve.
  • C++ / Python / C: No built-in support.

AST Validators

Validators perform static analysis on the Checked AST after type-checking to enforce domain-specific constraints before the program is executed.

  • Go: Supports ASTValidator interface. Canonical validators include cel.validator.duration , cel.validator.timestamp , cel.validator.matches (regex), cel.validator.homogeneous_literals , and cel.validator.comprehension_nesting_limit .
  • C++: Supports cel::Validator . Canonical validations include AstDepthValidator , ComprehensionNestingLimitValidator , DurationLiteralValidator , HomogeneousLiteralValidator , MatchesValidator , and TimestampLiteralValidator .
  • Java: Supports CelValidator and CelAstValidator . Canonical validators include AstDepthLimitValidator , ComprehensionNestingLimitValidator , DurationLiteralValidator , HomogeneousLiteralValidator , RegexLiteralValidator , and TimestampLiteralValidator .
  • Python / C: No direct support.

AST Optimizers

Optimizers rewrite the AST to improve execution performance. Optimizers fall into one of two categories: static and runtime optimizers. C++, Java, and Go support runtime optimization. CEL Java and Go also support static optimizers.

Typical optimizations include constant folding (pre-evaluating sub-expressions with constant inputs) and common subexpression elimination (CSE).

  • Go: Supports AST folding during compilation/planning.
  • C++: Supports constant folding via the cel::extensions::EnableConstantFolding extension at plan time.
  • Java: Supports CelOptimizer interface. Canonical optimizers include ConstantFoldingOptimizer (which supports pre-order traversal, Protobuf message constant folding, and aggregate or optional pruning), InliningOptimizer , and SubexpressionOptimizer (CSE).
  • Python / C: No direct support.

CEL Policy Compiler

CEL Policy is a YAML-based format for composing multiple CEL expressions together with variables, match blocks, conditional outputs, and nested rules. It is designed for complex policy engines (like Kubernetes Admission Control) where single CEL expressions would become unreadable.

For the formal language definition, syntax, and conformance suite, refer to the CEL Policy Specification .

The Policy Compiler compiles these YAML policies into a single standard CEL AST, meaning they are fully compatible with standard CEL runtimes and inherit all performance and safety guarantees.

  • Go: Supported via Go policy (including aggregate rule evaluation semantics).
  • C++: Supported via C++ policy .
  • Java: Supported via Java policy (including aggregate rule evaluation semantics and shorthand type specifiers in policy configs).
  • Python / C: Not directly supported.

Formal Verification Framework

The Formal Verification framework allows users to mathematically prove safety invariants, logical equivalence, satisfiability, and validity across CEL expressions and structured CEL Policies.

  • Java: Supported via the CEL Java Verifier ( dev.cel:verifier and dev.cel:verifier-cli ). Capabilities include satisfiability ( isSatisfiable ) with witness input generation, validity ( isAlwaysTrue ) with counterexample generation, bounded model checking (BMC) for comprehensions, logical equivalence proofs across ASTs, and custom assume / assert policy invariant verification.
  • Go / C++ / Python / C: Are supported indirectly via the Java command line toolchain.

ভূমিকা এবং বাস্তব-জগতের উদাহরণের জন্য, গুগল ওপেন সোর্স ব্লগ পোস্টটি দেখুন: Securing the agentic era: Introducing formal verification for CEL

,

This document serves as the unified API Doc reference for the Common Expression Language (CEL). It lists all macros, operators, and standard functions, indicating their signatures, behaviors, and support status across the official CEL stacks.

For more details on language behavior and specifications, refer to the CEL Language Definition .

Stack Versions

This reference document is based on the following versions of the CEL stacks:

  • CEL Go : v0.32.0 (and newer)
  • CEL C++ : v0.16.1
  • CEL Java : v0.14.0
  • CEL Python : v0.1.3
  • CEL C : Development snapshot (unreleased)

GitHub Mirrors

The official implementations of CEL are mirrored on GitHub under the cel-expr organization:


1. Core Macros

These are built-in macros that are expanded at compile time.

ম্যাক্রো বর্ণনা যান সি++ জাভা পাইথন সি
has(container.field) Tests whether a field is present in a message, or a key in a map.

Signatures:
has(container.field) -> bool

Examples:
has(request.auth.claims.email)
list.all(var, predicate) Tests whether all elements in a list satisfy a predicate.

Signatures:
list.all(var, predicate) -> bool

উদাহরণ:
[1, 2, 3].all(x, x > 0) // true
¹
list.exists(var, predicate) Tests whether at least one element in a list satisfies a predicate.

Signatures:
list.exists(var, predicate) -> bool

Examples:
[1, 2, 3].exists(x, x > 2) // true
¹
list.exists_one(var, predicate) Tests whether exactly one element in a list satisfies a predicate.

Signatures:
list.exists_one(var, predicate) -> bool

Examples:
[1, 2, 3].exists_one(x, x == 2) // true
¹
list.filter(var, predicate) Filters elements of a list according to a predicate.

Signatures:
list.filter(var, predicate) -> list

Examples:
[1, 2, 3].filter(x, x > 1) // [2, 3]
¹
list.map(var, transform) Transforms each element of a list using an expression.

Signatures:
list.map(var, transform) -> list

Examples:
[1, 2, 3].map(x, x * 2) // [2, 4, 6]
¹
list.map(var, filter, transform) Transforms elements of a list that satisfy a filter predicate.

Signatures:
list.map(var, filter, transform) -> list

Examples:
[1, 2, 3].map(x, x > 1, x * 2) // [4, 6]
¹

¹ Supported in C runtime because macros are expanded into comprehensions during compilation by the host compiler.


2. Core Operators

অপারেটর বর্ণনা যান সি++ জাভা পাইথন সি
Arithmetic ( + , - , * , / , % ) Standard arithmetic operations. Negation ( -x ) and Identity ( +x ). List concatenation ( list + list ) is supported in Go, C++, Java, and Python.

Signatures:
T + T -> T
T - T -> T
T * T -> T
T / T -> T
T % T -> T
-T -> T
+T -> T
list + list -> list

Examples:
1 + 2 * 3 // 7
[1] + [2] // [1, 2]
²
Comparison ( == , != , < , <= , > , >= ) Standard comparison. Numeric comparisons are heterogeneous (eg 1 == 1.0 ).

Signatures:
T == T -> bool
T != T -> bool
T < T -> bool
T <= T -> bool
T > T -> bool
T >= T -> bool

Examples:
x < 42.0
1 == 1.0 // true
Logical ( ! , && , || , ? : ) Logical NOT, AND, OR, and Ternary Conditional. AND/OR use short-circuit evaluation.

Signatures:
!bool -> bool
bool && bool -> bool
bool || bool -> bool
bool ? T : T -> T

Examples:
x > 0 ? "positive" : "non-positive"
Indexing ( [] ) Access element of a list by index, or lookup key in a map.

Signatures:
list[int] -> T
map[K] -> V

Examples:
tags[0]
users['john']
Membership ( in ) Check if element is in a list, or key is in a map.

Signatures:
T in list -> bool
K in map -> bool

Examples:
'admin' in roles

² List concatenation ( list + list ) is not supported in the C runtime, though other arithmetic operators are supported.


3. Core Functions

General & String Functions

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
size Returns the size of a string (characters), bytes, list, or map.

Signatures:
size(T) -> int (where T is string , bytes , list , or map )

Examples:
size("hello") // 5
contains Returns whether string contains substring.

Signatures:
string.contains(string) -> bool

Examples:
"hello".contains("ell") // true
startsWith Returns whether string starts with prefix.

Signatures:
string.startsWith(string) -> bool

Examples:
"hello".startsWith("he") // true
endsWith Returns whether string ends with suffix.

Signatures:
string.endsWith(string) -> bool

Examples:
"hello".endsWith("lo") // true
matches Returns whether string matches RE2 regular expression.

Signatures:
string.matches(string) -> bool

Examples:
"123".matches(r"^\d+$") // true

Date and Time Selector Functions

These functions extract components from google.protobuf.Timestamp or google.protobuf.Duration .

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
getFullYear Returns the 4-digit year.

Signatures:
timestamp.getFullYear([tz]) -> int

Examples:
timestamp("2026-07-23T00:00:00Z").getFullYear() // 2026
getMonth Returns the month (0-11).

Signatures:
timestamp.getMonth([tz]) -> int

Examples:
timestamp("2026-07-23T00:00:00Z").getMonth() // 6
getDayOfMonth Returns the day of the month (1-31).

Signatures:
timestamp.getDayOfMonth([tz]) -> int

Examples:
timestamp("2026-07-23T00:00:00Z").getDayOfMonth() // 23
getDayOfWeek Returns the day of the week (0 = Sunday).

Signatures:
timestamp.getDayOfWeek([tz]) -> int

Examples:
timestamp("2026-07-23T00:00:00Z").getDayOfWeek() // 4
getDayOfYear Returns the day of the year (0-365).

Signatures:
timestamp.getDayOfYear([tz]) -> int

Examples:
timestamp("2026-07-23T00:00:00Z").getDayOfYear() // 203
getHours Returns the hours (0-23).

Signatures:
timestamp.getHours([tz]) -> int
duration.getHours() -> int

Examples:
duration("1h30m").getHours() // 1
getMinutes Returns the minutes (0-59).

Signatures:
timestamp.getMinutes([tz]) -> int
duration.getMinutes() -> int

Examples:
duration("1h30m").getMinutes() // 30
getSeconds Returns the seconds (0-59).

Signatures:
timestamp.getSeconds([tz]) -> int
duration.getSeconds() -> int

Examples:
duration("1h30m45s").getSeconds() // 45
getMilliseconds Returns the milliseconds (0-999).

Signatures:
timestamp.getMilliseconds([tz]) -> int
duration.getMilliseconds() -> int

Examples:
duration("1.5s").getMilliseconds() // 500

টাইপ রূপান্তর

Target Type বর্ণনা যান সি++ জাভা পাইথন সি
bool Converts to boolean.

Signatures:
bool(bool) -> bool
bool(string) -> bool

Examples:
bool("true") // true
bytes Converts to bytes.

Signatures:
bytes(bytes) -> bytes
bytes(string) -> bytes

Examples:
bytes("hello") // b"hello"
double Converts to double-precision float.

Signatures:
double(double) -> double
double(int) -> double
double(uint) -> double
double(string) -> double

Examples:
double(1) // 1.0
duration Converts to duration.

Signatures:
duration(duration) -> duration
duration(string) -> duration

Examples:
duration("1.5s") // 1.5s duration
int Converts to 64-bit signed integer.

Signatures:
int(int) -> int
int(uint) -> int
int(double) -> int (rounds to zero)
int(string) -> int
int(timestamp) -> int (seconds since epoch)

Examples:
int(1.5) // 1
string Converts to string.

Signatures:
string(T) -> string (supports bool , int , uint , double , bytes , timestamp , duration )

Examples:
string(1.5) // "1.5"
timestamp Converts to timestamp.

Signatures:
timestamp(timestamp) -> timestamp
timestamp(string) -> timestamp (RFC3339)

Examples:
timestamp("2026-07-23T00:00:00Z")
uint Converts to 64-bit unsigned integer.

Signatures:
uint(uint) -> uint
uint(int) -> uint
uint(double) -> uint
uint(string) -> uint

Examples:
uint(1) // 1u
dyn Casts value to dynamic type for type-checking.

Signatures:
dyn(T) -> dyn

Examples:
dyn([1, "two"])
type Returns the type of the value.

Signatures:
type(T) -> type

Examples:
type(1) // int

4. Extensions (Libraries)

Bindings Library

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
cel.bind Binds a local variable to avoid duplicate evaluation.

Signatures:
cel.bind(varName, initExpr, resultExpr) -> T

Examples:
cel.bind(x, a + b, x * x)
(v0.15.0) (v0.10.0) (v0.2.0) (v0.1.1)

How to Enable

Encoders Library

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
base64.encode Encodes bytes to base64 string.

Signatures:
base64.encode(bytes) -> string

উদাহরণ:
base64.encode(b"hello") // "aGVsbG8="
(v0.6.0) (v0.10.0) (v0.2.0) (v0.1.1)
base64.decode Decodes base64 string to bytes. Throws error on invalid input.

Signatures:
base64.decode(string) -> bytes

Examples:
base64.decode("aGVsbG8=") // b"hello"
(v0.6.0) (v0.10.0) (v0.2.0) (v0.1.1)
json.encode Serializes a CEL value to JSON string.

Signatures:
json.encode(dyn) -> string

Examples:
json.encode([1, 2]) // "[1,2]"
(v0.29.0)

How to Enable

Math Library

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
math.greatest Returns greatest of numeric arguments (or list of numerics).

Signatures:
math.greatest(arg, ...) -> T

Examples:
math.greatest(1, 3, 2) // 3
(v0.13.0) (v0.10.0) (v0.2.0) (v0.1.1)
math.least Returns least of numeric arguments (or list of numerics).

Signatures:
math.least(arg, ...) -> T

Examples:
math.least([1, 3, 2]) // 1
(v0.13.0) (v0.10.0) (v0.2.0) (v0.1.1)
math.abs Absolute value.

Signatures:
math.abs(T) -> T (supports int , uint , double )

Examples:
math.abs(-1) // 1
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.sqrt বর্গমূল।

Signatures:
math.sqrt(T) -> double (supports int , uint , double )

Examples:
math.sqrt(9) // 3.0
(v0.25.1) (v0.12.0) (v0.11.0) (v0.1.1)
math.bitAnd Bitwise AND.

Signatures:
math.bitAnd(T, T) -> T (supports int , uint )

Examples:
math.bitAnd(5, 3) // 1
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.bitOr Bitwise OR.

Signatures:
math.bitOr(T, T) -> T (supports int , uint )

Examples:
math.bitOr(5, 3) // 7
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.bitXor Bitwise XOR.

Signatures:
math.bitXor(T, T) -> T (supports int , uint )

Examples:
math.bitXor(5, 3) // 6
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.bitNot Bitwise NOT.

Signatures:
math.bitNot(T) -> T (supports int , uint )

Examples:
math.bitNot(1) // -2
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.bitShiftLeft Bitwise shift left.

Signatures:
math.bitShiftLeft(T, int) -> T (supports int , uint )

উদাহরণ:
math.bitShiftLeft(1, 2) // 4
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.bitShiftRight Bitwise shift right.

Signatures:
math.bitShiftRight(T, int) -> T (supports int , uint )

Examples:
math.bitShiftRight(4, 2) // 1
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.ceil Ceiling rounding.

Signatures:
math.ceil(double) -> double

Examples:
math.ceil(1.2) // 2.0
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.floor Floor rounding.

Signatures:
math.floor(double) -> double

Examples:
math.floor(1.8) // 1.0
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.round Nearest integer rounding.

Signatures:
math.round(double) -> double

Examples:
math.round(1.5) // 2.0
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.trunc Truncation rounding (towards zero).

Signatures:
math.trunc(double) -> double

Examples:
math.trunc(-1.8) // -1.0
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.isInf Checks if double is positive or negative infinity.

Signatures:
math.isInf(double) -> bool

Examples:
math.isInf(1.0/0.0) // true
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.isNaN Checks if double is NaN.

Signatures:
math.isNaN(double) -> bool

Examples:
math.isNaN(0.0/0.0) // true
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.isFinite Checks if double is finite.

Signatures:
math.isFinite(double) -> bool

Examples:
math.isFinite(1.2) // true
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)
math.sign Returns sign of value (-1, 0, or 1).

Signatures:
math.sign(T) -> T (supports int , uint , double )

Examples:
math.sign(-42) // -1
(v0.21.0) (v0.11.0) (v0.10.1) (v0.1.1)

How to Enable

Protos Library

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
proto.getExt Gets proto2 extension field, or default if unset.

Signatures:
proto.getExt(msg, extName) -> T

Examples:
proto.getExt(msg, google.api.expr.test.int32_ext)
(v0.13.0) (v0.10.0) (v0.2.0) (v0.1.1)
proto.hasExt Checks if proto2 extension field is set.

Signatures:
proto.hasExt(msg, extName) -> bool

Examples:
proto.hasExt(msg, google.api.expr.test.int32_ext)
(v0.13.0) (v0.10.0) (v0.2.0) (v0.1.1)

How to Enable

Lists Library

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
distinct Returns distinct elements.

Signatures:
list.distinct() -> list

Examples:
[1, 2, 2].distinct() // [1, 2]
(v0.22.0) (v0.11.0) (v0.11.0) (v0.1.1)
flatten Flattens nested lists.

Signatures:
list.flatten([depth]) -> list

Examples:
[[1], [2, 3]].flatten() // [1, 2, 3]
(v0.22.0) (v0.11.0) (v0.7.1) (v0.1.1)
lists.range Returns list of integers [0, ..., n-1] .

Signatures:
lists.range(int) -> list(int)

Examples:
lists.range(3) // [0, 1, 2]
(v0.22.0) (v0.11.0) (v0.10.1) (v0.1.1)
reverse Reverses the list.

Signatures:
list.reverse() -> list

Examples:
[1, 2].reverse() // [2, 1]
(v0.22.0) (v0.11.0) (v0.11.0) (v0.1.1)
slice Returns sub-list (start inclusive, end exclusive).

Signatures:
list.slice(start, end) -> list

Examples:
[1, 2, 3].slice(1, 3) // [2, 3]
(v0.17.0) (v0.11.0) (v0.11.0) (v0.1.1)
sort Sorts list of comparable elements.

Signatures:
list.sort() -> list

Examples:
[3, 1, 2].sort() // [1, 2, 3]
(v0.22.0) (v0.11.0) (v0.11.0) (v0.1.1)
sortBy Sorts list by key evaluated from expression.

Signatures:
list.sortBy(var, expr) -> list

Examples:
[{"val": 2}, {"val": 1}].sortBy(x, x.val) // [{"val": 1}, {"val": 2}]
(v0.22.0) (v0.11.0) (v0.11.0) (v0.1.1)
first Returns first element as optional. Requires the Optional extension.

Signatures:
list.first() -> optional

Examples:
[1, 2].first() // optional(1)
(v0.23.0) (v0.15.0) (v0.11.0) (v0.1.2)
last Returns last element as optional. Requires the Optional extension.

Signatures:
list.last() -> optional

Examples:
[1, 2].last() // optional(2)
(v0.23.0) (v0.15.0) (v0.11.0) (v0.1.2)

How to Enable

Sets Library

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
sets.contains Checks if list1 contains all elements of list2.

Signatures:
sets.contains(list1, list2) -> bool

Examples:
sets.contains([1, 2], [1]) // true
(v0.15.0) (v0.10.0) (v0.6.0) (v0.1.1)
sets.equivalent Checks if lists are set-equivalent (contain same unique elements).

Signatures:
sets.equivalent(list1, list2) -> bool

Examples:
sets.equivalent([1, 2], [2, 1, 1]) // true
(v0.15.0) (v0.10.0) (v0.6.0) (v0.1.1)
sets.intersects Checks if lists share at least one element.

Signatures:
sets.intersects(list1, list2) -> bool

Examples:
sets.intersects([1, 2], [2, 3]) // true
(v0.15.0) (v0.10.0) (v0.6.0) (v0.1.1)

How to Enable

Strings Library

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
charAt Returns character at index.

Signatures:
string.charAt(int) -> string

Examples:
"hello".charAt(1) // "e"
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
indexOf Returns index of first occurrence of substring, or -1.

Signatures:
string.indexOf(substr, [start]) -> int

Examples:
"hello".indexOf("l") // 2
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
lastIndexOf Returns index of last occurrence of substring, or -1.

Signatures:
string.lastIndexOf(substr, [end]) -> int

উদাহরণ:
"hello".lastIndexOf("l") // 3
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
join Concatenates strings.

Signatures:
list(string).join([separator]) -> string

Examples:
["a", "b"].join("-") // "ab"
(v0.10.0) (v0.10.0) (v0.2.0) (v0.1.1)
split Splits string by separator.

Signatures:
string.split(separator, [limit]) -> list(string)

Examples:
"ab".split("-") // ["a", "b"]
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
substring Returns substring (start inclusive, end exclusive).

Signatures:
string.substring(start, [end]) -> string

Examples:
"hello".substring(1, 3) // "el"
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
trim Trims Unicode whitespace.

Signatures:
string.trim() -> string

Examples:
" hello ".trim() // "hello"
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
replace Replaces occurrences of old with new.

Signatures:
string.replace(old, new, [limit]) -> string

Examples:
"hello".replace("l", "w") // "hewwo"
(v0.4.0) (v0.10.0) (v0.2.0) (v0.1.1)
reverse Reverses Unicode code points.

Signatures:
string.reverse() -> string

Examples:
"abc".reverse() // "cba"
(v0.18.0) (v0.14.0) (v0.13.0) (v0.1.1)
lowerAscii Converts ASCII characters to lowercase.

Signatures:
string.lowerAscii() -> string

Examples:
"Hello".lowerAscii() // "hello"
(v0.6.0) (v0.11.0) (v0.2.0) (v0.1.1)
upperAscii Converts ASCII characters to uppercase.

Signatures:
string.upperAscii() -> string

Examples:
"Hello".upperAscii() // "HELLO"
(v0.6.0) (v0.11.0) (v0.2.0) (v0.1.1)
quote Escapes string for safe printing.

Signatures:
strings.quote(string) -> string

Examples:
strings.quote("a\tb") // "\"a\\tb\""
(v0.14.0) (v0.14.0) (v0.13.0) (v0.1.1)
format Formats the string using printf-style placeholders.

Signatures:
string.format(list) -> string

Examples:
"str: %s, int: %d".format(["a", 1]) // "str: a, int: 1"
(v0.14.0) (v0.11.0) (v0.1.1)

How to Enable

Regular Expression Library

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
regex.replace Replaces matches with replacement string (supports backreferences).

Signatures:
regex.replace(target, pat, repl, [limit]) -> string

Examples:
regex.replace("123-456", r"(\d+)-(\d+)", r"\2-\1") // "456-123"
(v0.25.1) (v0.13.0) (v0.10.1) (v0.1.1)
regex.extract Returns first match of pattern (must have one capture group).

Signatures:
regex.extract(target, pat) -> optional(string)

Examples:
regex.extract("a123b", r"(\d+)") // optional("123")
(v0.25.1) (v0.13.0) (v0.10.1) (v0.1.1)
regex.extractAll Returns all matches of pattern (must have one capture group).

Signatures:
regex.extractAll(target, pat) -> list(string)

Examples:
regex.extractAll("a1b2", r"(\d+)") // ["1", "2"]
(v0.25.1) (v0.13.0) (v0.10.1) (v0.1.1)

How to Enable

Two-Variable Comprehensions

ম্যাক্রো বর্ণনা যান সি++ জাভা পাইথন সি
all Short-circuiting logical AND over key/index and value.

Signatures:
list.all(i, v, pred) -> bool
map.all(k, v, pred) -> bool

Examples:
[1, 2].all(i, v, v > 0) // true
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)
exists Short-circuiting logical OR over key/index and value.

Signatures:
list.exists(i, v, pred) -> bool
map.exists(k, v, pred) -> bool

Examples:
[1, 2].exists(i, v, v == 2) // true
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)
existsOne Checks if exactly one pair satisfies predicate.

Signatures:
list.existsOne(i, v, pred) -> bool
map.existsOne(k, v, pred) -> bool

Examples:
[1, 2].existsOne(i, v, v == 2) // true
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)
transformList Transforms/filters list/map into a list.

Signatures:
list.transformList(i, v, [filter], transform) -> list
map.transformList(k, v, [filter], transform) -> list

Examples:
[1, 2].transformList(i, v, v * 2) // [2, 4]
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)
transformMap Transforms values of list/map into a map (keys remain fixed).

Signatures:
list.transformMap(i, v, [filter], transform) -> map
map.transformMap(k, v, [filter], transform) -> map

Examples:
[1, 2].transformMap(i, v, v * 2) // {0: 2, 1: 4}
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)
transformMapEntry Transforms into a map.

Signatures:
list.transformMapEntry(i, v, [filter], transform_entry) -> map
map.transformMapEntry(k, v, [filter], transform_entry) -> map

Examples:
[1, 2].transformMapEntry(i, v, {string(v): v * 2}) // {"1": 2, "2": 4}
(v0.22.0) (v0.14.0) (v0.11.0) (v0.1.1)

How to Enable

Native Types Library

বৈশিষ্ট্য বর্ণনা যান সি++ জাভা পাইথন সি
Native Structs Registering and instantiating host native types (Go structs / Java POJOs) in CEL.

Examples:
Account{id: 123} (Java POJO instanced in CEL)
(v0.13.0) (v0.13.0)

How to Enable

Network Library

The Network library provides functions for parsing, validating, and manipulating IP addresses and CIDR blocks.

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
ip Parses a string into an IP address, or extracts the IP from a CIDR.

Signatures:
ip(string) -> IP
CIDR.ip() -> IP

Examples:
ip("192.168.0.1")
cidr("192.168.0.0/24").ip()
(v0.29.0)
isIP Checks if a string is a valid IP address.

Signatures:
isIP(string) -> bool

Examples:
isIP("192.168.0.1") // true
(v0.29.0)
ip.isCanonical Checks if an IP address string is in its canonical format.

Signatures:
ip.isCanonical(string) -> bool

Examples:
ip.isCanonical("192.168.0.1") // true
(v0.29.0)
cidr Parses a string into a CIDR block.

Signatures:
cidr(string) -> CIDR

উদাহরণ:
cidr("192.168.0.0/24")
(v0.29.0)
isCIDR Checks if a string is a valid CIDR block.

Signatures:
isCIDR(string) -> bool

Examples:
isCIDR("192.168.0.0/24") // true
(v0.29.0)
containsIP Checks if a CIDR block contains an IP address.

Signatures:
CIDR.containsIP(IP) -> bool
CIDR.containsIP(string) -> bool

Examples:
cidr("192.168.0.0/24").containsIP(ip("192.168.0.1")) // true
(v0.29.0)
containsCIDR Checks if a CIDR block contains another CIDR block.

Signatures:
CIDR.containsCIDR(CIDR) -> bool
CIDR.containsCIDR(string) -> bool

Examples:
cidr("192.168.0.0/16").containsCIDR(cidr("192.168.1.0/24")) // true
(v0.29.0)
family Returns the IP family (4 for IPv4, 6 for IPv6).

Signatures:
IP.family() -> int

Examples:
ip("192.168.0.1").family() // 4
(v0.29.0)
isGlobalUnicast Checks if the IP is a global unicast address.

Signatures:
IP.isGlobalUnicast() -> bool

Examples:
ip("192.168.0.1").isGlobalUnicast() // true
(v0.29.0)
isLinkLocalMulticast Checks if the IP is a link-local multicast address.

Signatures:
IP.isLinkLocalMulticast() -> bool

Examples:
ip("224.0.0.1").isLinkLocalMulticast() // true
(v0.29.0)
isLinkLocalUnicast Checks if the IP is a link-local unicast address.

Signatures:
IP.isLinkLocalUnicast() -> bool

Examples:
ip("169.254.0.1").isLinkLocalUnicast() // true
(v0.29.0)
isLoopback Checks if the IP is a loopback address.

Signatures:
IP.isLoopback() -> bool

Examples:
ip("127.0.0.1").isLoopback() // true
(v0.29.0)
isMask Checks if the CIDR is a valid subnet mask.

Signatures:
CIDR.isMask() -> bool

Examples:
cidr("255.255.255.0/24").isMask() // true
(v0.29.0)
isUnspecified Checks if the IP is an unspecified address (eg 0.0.0.0 ).

Signatures:
IP.isUnspecified() -> bool

Examples:
ip("0.0.0.0").isUnspecified() // true
(v0.29.0)
masked Returns the masked CIDR block.

Signatures:
CIDR.masked() -> CIDR

Examples:
cidr("192.168.0.1/24").masked() // 192.168.0.0/24
(v0.29.0)
prefixLength Returns the prefix length of the CIDR block.

Signatures:
CIDR.prefixLength() -> int

Examples:
cidr("192.168.0.0/24").prefixLength() // 24
(v0.29.0)
string Converts IP or CIDR to string.

Signatures:
string(IP) -> string
string(CIDR) -> string

Examples:
string(ip("192.168.0.1")) // "192.168.0.1"
(v0.29.0)

How to Enable

  • Go: Pass ext.Network() to cel.NewEnv() .
  • C++: Not supported.
  • Java: Not supported.
  • Python: Not supported.

JWT Library

The JWT library provides data types and helper functions for parsing JSON Web Tokens (JWT) and inspecting standard and custom claims.

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
jwt.parse Parses a raw token string into a structured jwt.Token wrapped in an optional.

Signatures:
jwt.parse(string) -> optional(jwt.Token)

Examples:
jwt.parse(token_string).hasValue()
(v0.32.0)
claim Queries a custom claim value by key name from the token payload.

Signatures:
jwt.Token.claim(string) -> optional(dyn)
optional(jwt.Token).claim(string) -> optional(dyn)

Examples:
jwt.parse(token).claim("tenant").orValue("")
(v0.32.0)
presentedBy Validates that the token's issuer and audience match expected values.

Signatures:
jwt.Token.presentedBy(string, string) -> bool
optional(jwt.Token).presentedBy(string, string) -> bool

Examples:
jwt.parse(token).presentedBy("https://auth.example.com", "https://api.example.com")
(v0.32.0)

How to Enable

  • Go: Import cel.dev/cel-go/ext/security/jwt and pass jwt.Library() to cel.NewEnv() .
  • C++: Not supported.
  • Java: Not supported.
  • Python: Not supported.

HMAC Library

The HMAC library provides cryptographic functions to compute and verify Hash-based Message Authentication Codes (HMAC) over strings and byte sequences.

ফাংশন বর্ণনা যান সি++ জাভা পাইথন সি
hmac.compute Computes raw HMAC signature bytes using the specified algorithm and secret key.

Signatures:
hmac.compute(string, string|bytes, string|bytes) -> bytes

উদাহরণ:
hmac.compute(hmac.SHA256, "secret", "message")
(v0.32.0)
hmac.verify Verifies whether an HMAC signature matches the expected digest.

Signatures:
hmac.verify(string, string|bytes, string|bytes, string|bytes) -> bool

Examples:
hmac.verify(hmac.SHA256, secret, msg, expected_sig) // true
(v0.32.0)

How to Enable

  • Go: Import cel.dev/cel-go/ext/security/hmac and pass hmac.Library() to cel.NewEnv() .
  • C++: Not supported.
  • Java: Not supported.
  • Python: Not supported.

5. Advanced Features

Advanced Features Summary

বৈশিষ্ট্য বর্ণনা যান সি++ জাভা পাইথন সি
Partial Evaluation Evaluate with missing inputs; returns unknowns or a simplified expression. ³
Async Evaluation Non-blocking concurrent execution of extension functions.
AST Validators Static analysis checks on the Checked AST after type-checking.
AST Optimizers AST rewrites (constant folding, inlining, CSE) to improve performance.
CEL Policy Compiler Compiles YAML-based policy structures into standard CEL ASTs.
Formal Verification Proves safety invariants, satisfiability, validity, and AST equivalence. (v0.14.0)

³ Go supports generating a Residual AST (pruned AST). ⁴ C++ and Java support returning UnknownSet / CelUnknownSet at runtime, but do not expose public APIs for residual AST generation. ⁵ Go uses AsyncBinding / AsyncOp returning channels. ⁶ Java uses CelAsyncRuntime returning ListenableFuture .

Partial Evaluation (Unknowns)

Partial evaluation allows evaluating an expression when only a subset of the input variables (arguments) are known. Instead of failing, the evaluation produces a result that indicates what is missing, or a simplified expression.

  • Go: Full support. Allows defining a PartialActivation with patterns of unknown attributes. Evaluation returns a types.Unknown value. Go supports generating a Residual AST ( Env.ResidualAst ) which is a pruned, simplified AST containing only the parts of the expression that could not be evaluated.
  • C++: Supports Unknown values. Unknown attribute patterns are configured via Activation::set_unknown_attribute_patterns . Evaluation returns an UnknownSet . Public API does not currently expose residual AST generation.
  • Java: Supports partial evaluation via PartialVars passed to Program.eval() . Evaluation returns a CelUnknownSet . Public API does not currently expose residual AST generation.
  • Python / C: No native support.

Async Evaluation

Async evaluation allows CEL expressions to call functions that execute asynchronously (eg, making RPCs or database queries) and block evaluation until the results are available, without blocking the main execution thread.

  • Go: Supports asynchronous function overloads via AsyncBinding and AsyncOp . Async functions return a Go channel ( <-chan ref.Val ), and the interpreter manages the concurrent execution and synchronization.
  • Java: Supports async evaluation via CelAsyncRuntime and AsyncProgram . It uses ListenableFuture to represent pending values and automatically drives evaluation to completion as futures resolve.
  • C++ / Python / C: No built-in support.

AST Validators

Validators perform static analysis on the Checked AST after type-checking to enforce domain-specific constraints before the program is executed.

  • Go: Supports ASTValidator interface. Canonical validators include cel.validator.duration , cel.validator.timestamp , cel.validator.matches (regex), cel.validator.homogeneous_literals , and cel.validator.comprehension_nesting_limit .
  • C++: Supports cel::Validator . Canonical validations include AstDepthValidator , ComprehensionNestingLimitValidator , DurationLiteralValidator , HomogeneousLiteralValidator , MatchesValidator , and TimestampLiteralValidator .
  • Java: Supports CelValidator and CelAstValidator . Canonical validators include AstDepthLimitValidator , ComprehensionNestingLimitValidator , DurationLiteralValidator , HomogeneousLiteralValidator , RegexLiteralValidator , and TimestampLiteralValidator .
  • Python / C: No direct support.

AST Optimizers

Optimizers rewrite the AST to improve execution performance. Optimizers fall into one of two categories: static and runtime optimizers. C++, Java, and Go support runtime optimization. CEL Java and Go also support static optimizers.

Typical optimizations include constant folding (pre-evaluating sub-expressions with constant inputs) and common subexpression elimination (CSE).

  • Go: Supports AST folding during compilation/planning.
  • C++: Supports constant folding via the cel::extensions::EnableConstantFolding extension at plan time.
  • Java: Supports CelOptimizer interface. Canonical optimizers include ConstantFoldingOptimizer (which supports pre-order traversal, Protobuf message constant folding, and aggregate or optional pruning), InliningOptimizer , and SubexpressionOptimizer (CSE).
  • Python / C: No direct support.

CEL Policy Compiler

CEL Policy is a YAML-based format for composing multiple CEL expressions together with variables, match blocks, conditional outputs, and nested rules. It is designed for complex policy engines (like Kubernetes Admission Control) where single CEL expressions would become unreadable.

For the formal language definition, syntax, and conformance suite, refer to the CEL Policy Specification .

The Policy Compiler compiles these YAML policies into a single standard CEL AST, meaning they are fully compatible with standard CEL runtimes and inherit all performance and safety guarantees.

  • Go: Supported via Go policy (including aggregate rule evaluation semantics).
  • C++: Supported via C++ policy .
  • Java: Supported via Java policy (including aggregate rule evaluation semantics and shorthand type specifiers in policy configs).
  • Python / C: Not directly supported.

Formal Verification Framework

The Formal Verification framework allows users to mathematically prove safety invariants, logical equivalence, satisfiability, and validity across CEL expressions and structured CEL Policies.

  • Java: Supported via the CEL Java Verifier ( dev.cel:verifier and dev.cel:verifier-cli ). Capabilities include satisfiability ( isSatisfiable ) with witness input generation, validity ( isAlwaysTrue ) with counterexample generation, bounded model checking (BMC) for comprehensions, logical equivalence proofs across ASTs, and custom assume / assert policy invariant verification.
  • Go / C++ / Python / C: Are supported indirectly via the Java command line toolchain.

ভূমিকা এবং বাস্তব-জগতের উদাহরণের জন্য, গুগল ওপেন সোর্স ব্লগ পোস্টটি দেখুন: Securing the agentic era: Introducing formal verification for CEL