Skip to content

Commit dd8897e

Browse files
authored
feat: add rand and trunc expressions (#2493)
* add rand and trunc expressions and documentation * remove the dash for doc consistency
1 parent c69ca15 commit dd8897e

File tree

5 files changed

+392
-38
lines changed

5 files changed

+392
-38
lines changed

api-report/firestore.api.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,9 @@ abstract class Expression implements firestore.Pipelines.Expression, HasUserData
10941094
abstract _toProto(serializer: Serializer): api.IValue;
10951095
toUpper(): FunctionExpression;
10961096
trim(valueToTrim?: string | Expression | Uint8Array | Buffer): FunctionExpression;
1097+
trunc(): FunctionExpression;
1098+
trunc(decimalPlaces: number): FunctionExpression;
1099+
trunc(decimalPlaces: Expression): FunctionExpression;
10971100
// Warning: (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag
10981101
// Warning: (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@"
10991102
type(): FunctionExpression;
@@ -1925,6 +1928,8 @@ declare namespace Pipelines {
19251928
ln,
19261929
round,
19271930
sqrt,
1931+
rand,
1932+
trunc,
19281933
stringReverse,
19291934
abs,
19301935
arraySum,
@@ -2273,6 +2278,9 @@ export class QuerySnapshot<AppModelType = firestore.DocumentData, DbModelType ex
22732278
get size(): number;
22742279
}
22752280

2281+
// @beta
2282+
function rand(): FunctionExpression;
2283+
22762284
// @beta
22772285
function regexContains(fieldName: string, pattern: string): BooleanExpression;
22782286

@@ -2640,6 +2648,18 @@ function trim(fieldName: string, valueToTrim?: string | Expression): FunctionExp
26402648
// @beta
26412649
function trim(stringExpression: Expression, valueToTrim?: string | Expression): FunctionExpression;
26422650

2651+
// @beta
2652+
function trunc(fieldName: string): FunctionExpression;
2653+
2654+
// @beta
2655+
function trunc(expression: Expression): FunctionExpression;
2656+
2657+
// @beta
2658+
function trunc(fieldName: string, decimalPlaces: number | Expression): FunctionExpression;
2659+
2660+
// @beta
2661+
function trunc(expression: Expression, decimalPlaces: number | Expression): FunctionExpression;
2662+
26432663
// Warning: (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag
26442664
// Warning: (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@"
26452665
//

0 commit comments

Comments
 (0)