@@ -570,6 +570,53 @@ abstract class Expr internal constructor() {
570
570
fun bitRightShift (bitsFieldName : String , number : Int ): Expr =
571
571
FunctionExpr (" bit_right_shift" , bitsFieldName, number)
572
572
573
+ @JvmStatic
574
+ fun round (numericExpr : Expr , decimalPlace : Int ): Expr =
575
+ FunctionExpr (" round" , numericExpr, constant(decimalPlace))
576
+
577
+ @JvmStatic
578
+ fun round (numericField : String , decimalPlace : Int ): Expr =
579
+ FunctionExpr (" round" , numericField, constant(decimalPlace))
580
+
581
+ @JvmStatic fun round (numericExpr : Expr ): Expr = FunctionExpr (" round" , numericExpr)
582
+
583
+ @JvmStatic fun round (numericField : String ): Expr = FunctionExpr (" round" , numericField)
584
+
585
+ @JvmStatic
586
+ fun round (numericExpr : Expr , decimalPlace : Expr ): Expr =
587
+ FunctionExpr (" round" , numericExpr, decimalPlace)
588
+
589
+ @JvmStatic
590
+ fun round (numericField : String , decimalPlace : Expr ): Expr =
591
+ FunctionExpr (" round" , numericField, decimalPlace)
592
+
593
+ @JvmStatic fun ceil (numericExpr : Expr ): Expr = FunctionExpr (" ceil" , numericExpr)
594
+
595
+ @JvmStatic fun ceil (numericField : String ): Expr = FunctionExpr (" ceil" , numericField)
596
+
597
+ @JvmStatic fun floor (numericExpr : Expr ): Expr = FunctionExpr (" floor" , numericExpr)
598
+
599
+ @JvmStatic fun floor (numericField : String ): Expr = FunctionExpr (" floor" , numericField)
600
+
601
+ @JvmStatic
602
+ fun pow (numericExpr : Expr , exponent : Number ): Expr =
603
+ FunctionExpr (" pow" , numericExpr, constant(exponent))
604
+
605
+ @JvmStatic
606
+ fun pow (numericField : String , exponent : Number ): Expr =
607
+ FunctionExpr (" pow" , numericField, constant(exponent))
608
+
609
+ @JvmStatic
610
+ fun pow (numericExpr : Expr , exponent : Expr ): Expr = FunctionExpr (" pow" , numericExpr, exponent)
611
+
612
+ @JvmStatic
613
+ fun pow (numericField : String , exponent : Expr ): Expr =
614
+ FunctionExpr (" pow" , numericField, exponent)
615
+
616
+ @JvmStatic fun sqrt (numericExpr : Expr ): Expr = FunctionExpr (" sqrt" , numericExpr)
617
+
618
+ @JvmStatic fun sqrt (numericField : String ): Expr = FunctionExpr (" sqrt" , numericField)
619
+
573
620
/* *
574
621
* Creates an expression that adds this expression to another expression.
575
622
*
@@ -1243,35 +1290,69 @@ abstract class Expr internal constructor() {
1243
1290
fun map (elements : Map <String , Any >): Expr =
1244
1291
map(elements.flatMap { listOf (constant(it.key), toExprOrConstant(it.value)) }.toTypedArray())
1245
1292
1246
- /* * @return A new [Expr] representing the mapGet operation. */
1247
- @JvmStatic fun mapGet ( map : Expr , key : Expr ): Expr = FunctionExpr ( " map_get " , map, key)
1248
-
1249
- /* * @return A new [Expr] representing the mapGet operation. */
1250
- @JvmStatic fun mapGet ( map : Expr , key : String ): Expr = FunctionExpr ( " map_get " , map, key)
1251
-
1252
- /* * @return A new [Expr] representing the mapGet operation. */
1293
+ /* *
1294
+ * Accesses a value from a map (object) field using the provided [ key].
1295
+ *
1296
+ * @param mapExpression The expression representing the map.
1297
+ * @param key The key to access in the map.
1298
+ * @return A new [Expr] representing the value associated with the given key in the map.
1299
+ */
1253
1300
@JvmStatic
1254
- fun mapGet (fieldName : String , key : Expr ): Expr = FunctionExpr (" map_get" , fieldName , key)
1301
+ fun mapGet (mapExpression : Expr , key : String ): Expr = FunctionExpr (" map_get" , mapExpression , key)
1255
1302
1256
- /* * @return A new [Expr] representing the mapGet operation. */
1303
+ /* *
1304
+ * Accesses a value from a map (object) field using the provided [key].
1305
+ *
1306
+ * @param fieldName The field name of the map field.
1307
+ * @param key The key to access in the map.
1308
+ * @return A new [Expr] representing the value associated with the given key in the map.
1309
+ */
1257
1310
@JvmStatic
1258
1311
fun mapGet (fieldName : String , key : String ): Expr = FunctionExpr (" map_get" , fieldName, key)
1259
1312
1260
- /* * @return A new [Expr] representing the mapMerge operation. */
1313
+ /* *
1314
+ * Creates an expression that merges multiple maps into a single map. If multiple maps have the
1315
+ * same key, the later value is used.
1316
+ *
1317
+ * @param firstMap First map expression that will be merged.
1318
+ * @param secondMap Second map expression that will be merged.
1319
+ * @param otherMaps Additional maps to merge.
1320
+ * @return A new [Expr] representing the mapMerge operation.
1321
+ */
1261
1322
@JvmStatic
1262
1323
fun mapMerge (firstMap : Expr , secondMap : Expr , vararg otherMaps : Expr ): Expr =
1263
1324
FunctionExpr (" map_merge" , firstMap, secondMap, * otherMaps)
1264
1325
1265
- /* * @return A new [Expr] representing the mapMerge operation. */
1326
+ /* *
1327
+ * Creates an expression that merges multiple maps into a single map. If multiple maps have the
1328
+ * same key, the later value is used.
1329
+ *
1330
+ * @param firstMapFieldName First map field name that will be merged.
1331
+ * @param secondMap Second map expression that will be merged.
1332
+ * @param otherMaps Additional maps to merge.
1333
+ * @return A new [Expr] representing the mapMerge operation.
1334
+ */
1266
1335
@JvmStatic
1267
- fun mapMerge (mapField : String , secondMap : Expr , vararg otherMaps : Expr ): Expr =
1268
- FunctionExpr (" map_merge" , mapField , secondMap, * otherMaps)
1336
+ fun mapMerge (firstMapFieldName : String , secondMap : Expr , vararg otherMaps : Expr ): Expr =
1337
+ FunctionExpr (" map_merge" , firstMapFieldName , secondMap, * otherMaps)
1269
1338
1270
- /* * @return A new [Expr] representing the mapRemove operation. */
1339
+ /* *
1340
+ * Creates an expression that removes a key from the map produced by evaluating an expression.
1341
+ *
1342
+ * @param mapExpr An expression return a map value.
1343
+ * @param key The name of the key to remove from the input map.
1344
+ * @return A new [Expr] that evaluates to a modified map.
1345
+ */
1271
1346
@JvmStatic
1272
- fun mapRemove (firstMap : Expr , key : Expr ): Expr = FunctionExpr (" map_remove" , firstMap , key)
1347
+ fun mapRemove (mapExpr : Expr , key : Expr ): Expr = FunctionExpr (" map_remove" , mapExpr , key)
1273
1348
1274
- /* * @return A new [Expr] representing the mapRemove operation. */
1349
+ /* *
1350
+ * Creates an expression that removes a key from the map produced by evaluating an expression.
1351
+ *
1352
+ * @param mapField The name of a field containing a map value.
1353
+ * @param key The name of the key to remove from the input map.
1354
+ * @return A new [Expr] that evaluates to a modified map.
1355
+ */
1275
1356
@JvmStatic
1276
1357
fun mapRemove (mapField : String , key : Expr ): Expr = FunctionExpr (" map_remove" , mapField, key)
1277
1358
@@ -2348,6 +2429,22 @@ abstract class Expr internal constructor() {
2348
2429
*/
2349
2430
fun mod (other : Any ) = Companion .mod(this , other)
2350
2431
2432
+ fun round () = Companion .round(this )
2433
+
2434
+ fun round (decimalPlace : Int ) = Companion .round(this , decimalPlace)
2435
+
2436
+ fun round (decimalPlace : Expr ) = Companion .round(this , decimalPlace)
2437
+
2438
+ fun ceil () = Companion .ceil(this )
2439
+
2440
+ fun floor () = Companion .floor(this )
2441
+
2442
+ fun pow (exponentExpr : Number ) = Companion .pow(this , exponentExpr)
2443
+
2444
+ fun pow (exponentExpr : Expr ) = Companion .pow(this , exponentExpr)
2445
+
2446
+ fun sqrt () = Companion .sqrt(this )
2447
+
2351
2448
/* *
2352
2449
* Creates an expression that checks if this expression, when evaluated, is equal to any of the
2353
2450
* provided [values].
@@ -2591,17 +2688,23 @@ abstract class Expr internal constructor() {
2591
2688
fun strConcat (vararg string : Any ) = Companion .strConcat(this , * string)
2592
2689
2593
2690
/* *
2594
- */
2595
- fun mapGet ( key : Expr ) = Companion .mapGet( this , key)
2596
-
2597
- /* *
2691
+ * Accesses a map (object) value using the provided [key].
2692
+ *
2693
+ * @param key The key to access in the map.
2694
+ * @return A new [Expr] representing the value associated with the given key in the map.
2598
2695
*/
2599
2696
fun mapGet (key : String ) = Companion .mapGet(this , key)
2600
2697
2601
2698
/* *
2699
+ * Creates an expression that merges multiple maps into a single map. If multiple maps have the
2700
+ * same key, the later value is used.
2701
+ *
2702
+ * @param mapExpr Map expression that will be merged.
2703
+ * @param otherMaps Additional maps to merge.
2704
+ * @return A new [Expr] representing the mapMerge operation.
2602
2705
*/
2603
- fun mapMerge (secondMap : Expr , vararg otherMaps : Expr ) =
2604
- Companion .mapMerge(this , secondMap , * otherMaps)
2706
+ fun mapMerge (mapExpr : Expr , vararg otherMaps : Expr ) =
2707
+ Companion .mapMerge(this , mapExpr , * otherMaps)
2605
2708
2606
2709
/* *
2607
2710
*/
0 commit comments