Skip to content

Commit 3a258b2

Browse files
committed
rename timestampSubtract
1 parent 452875f commit 3a258b2

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

Firestore/Swift/Source/ExpressionImplementation.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,11 +853,11 @@ public extension Expression {
853853
)
854854
}
855855

856-
func timestampSub(amount: Expression, unit: Expression) -> FunctionExpression {
856+
func timestampSubtract(amount: Expression, unit: Expression) -> FunctionExpression {
857857
return FunctionExpression("timestamp_subtract", [self, unit, amount])
858858
}
859859

860-
func timestampSub(_ amount: Int, _ unit: TimeUnit) -> FunctionExpression {
860+
func timestampSubtract(_ amount: Int, _ unit: TimeUnit) -> FunctionExpression {
861861
return FunctionExpression(
862862
"timestamp_subtract",
863863
[self, Helper.sendableToExpr(unit), Helper.sendableToExpr(amount)]

Firestore/Swift/Source/SwiftAPI/Pipeline/Expressions/Expression.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,15 +1459,15 @@ public protocol Expression: Sendable {
14591459
///
14601460
/// ```swift
14611461
/// // Subtract duration from "unitField"/"amountField" from "timestamp"
1462-
/// Field("timestamp").timestampSub(amount: Field("amountField"), unit: Field("unitField"))
1462+
/// Field("timestamp").timestampSubtract(amount: Field("amountField"), unit: Field("unitField"))
14631463
/// ```
14641464
///
1465-
/// - Parameter unit: An `Expr` evaluating to the unit of time string (e.g., "day", "hour").
1465+
/// - Parameter unit: An `Expression` evaluating to the unit of time string (e.g., "day", "hour").
14661466
/// Valid units are "microsecond", "millisecond", "second", "minute", "hour",
14671467
/// "day".
1468-
/// - Parameter amount: An `Expr` evaluating to the amount (Int) of the unit to subtract.
1468+
/// - Parameter amount: An `Expression` evaluating to the amount (Int) of the unit to subtract.
14691469
/// - Returns: A new "FunctionExpression" representing the resulting timestamp.
1470-
func timestampSub(amount: Expression, unit: Expression) -> FunctionExpression
1470+
func timestampSubtract(amount: Expression, unit: Expression) -> FunctionExpression
14711471

14721472
/// Creates an expression that subtracts a specified amount of time from this timestamp
14731473
/// expression,
@@ -1476,13 +1476,13 @@ public protocol Expression: Sendable {
14761476
///
14771477
/// ```swift
14781478
/// // Subtract 1 day from the "timestamp" field.
1479-
/// Field("timestamp").timestampSub(1, .day)
1479+
/// Field("timestamp").timestampSubtract(1, .day)
14801480
/// ```
14811481
///
14821482
/// - Parameter unit: The `TimeUnit` enum representing the unit of time.
14831483
/// - Parameter amount: The literal `Int` amount of the unit to subtract.
14841484
/// - Returns: A new "FunctionExpression" representing the resulting timestamp.
1485-
func timestampSub(_ amount: Int, _ unit: TimeUnit) -> FunctionExpression
1485+
func timestampSubtract(_ amount: Int, _ unit: TimeUnit) -> FunctionExpression
14861486

14871487
/// Creates an expression that returns the document ID from a path.
14881488
///

Firestore/Swift/Tests/Integration/PipelineTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3080,12 +3080,12 @@ class PipelineIntegrationTests: FSTIntegrationTestCase {
30803080
Field("timestamp").timestampAdd(10, .second).as("plus10seconds"),
30813081
Field("timestamp").timestampAdd(10, .microsecond).as("plus10micros"),
30823082
Field("timestamp").timestampAdd(10, .millisecond).as("plus10millis"),
3083-
Field("timestamp").timestampSub(10, .day).as("minus10days"),
3084-
Field("timestamp").timestampSub(10, .hour).as("minus10hours"),
3085-
Field("timestamp").timestampSub(10, .minute).as("minus10minutes"),
3086-
Field("timestamp").timestampSub(10, .second).as("minus10seconds"),
3087-
Field("timestamp").timestampSub(10, .microsecond).as("minus10micros"),
3088-
Field("timestamp").timestampSub(10, .millisecond).as("minus10millis"),
3083+
Field("timestamp").timestampSubtract(10, .day).as("minus10days"),
3084+
Field("timestamp").timestampSubtract(10, .hour).as("minus10hours"),
3085+
Field("timestamp").timestampSubtract(10, .minute).as("minus10minutes"),
3086+
Field("timestamp").timestampSubtract(10, .second).as("minus10seconds"),
3087+
Field("timestamp").timestampSubtract(10, .microsecond).as("minus10micros"),
3088+
Field("timestamp").timestampSubtract(10, .millisecond).as("minus10millis"),
30893089
]
30903090
)
30913091

0 commit comments

Comments
 (0)