Skip to content

Commit 059c24f

Browse files
Make ServerValue.increment() public (#5256)
1 parent 0e9d5f0 commit 059c24f

File tree

5 files changed

+20
-44
lines changed

5 files changed

+20
-44
lines changed

Example/Database/Tests/Integration/FData.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#import "FEventTester.h"
2222
#import "FIRDatabaseConfig_Private.h"
2323
#import "FIRDatabaseQuery_Private.h"
24-
#import "FIRServerValue_unreleased.h"
24+
#import "FIRServerValue.h"
2525
#import "FRepo_Private.h"
2626
#import "FTestHelpers.h"
2727
#import "FTupleEventTypeString.h"

Firebase/Database/Api/FIRServerValue.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616

1717
#import "FIRServerValue.h"
18-
#import "FIRServerValue_unreleased.h"
1918

2019
@implementation FIRServerValue
2120

Firebase/Database/Api/FIRServerValue_unreleased.h

Lines changed: 0 additions & 42 deletions
This file was deleted.

Firebase/Database/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Unreleased
2+
- [feature] Added `ServerValue.increment()` to support atomic field value increments
3+
without transactions.
24

35
# v6.1.4
46
- [changed] Addressed a performance regression introduced in 6.1.3.

Firebase/Database/Public/FIRServerValue.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,23 @@ NS_SWIFT_NAME(ServerValue)
3131
*/
3232
+ (NSDictionary *)timestamp;
3333

34+
/**
35+
* Returns a placeholder value that can be used to atomically increment the
36+
* current database value by the provided delta.
37+
*
38+
* The delta must be an long or a double value. If the current value is not an
39+
* integer or double, or if the data does not yet exist, the transformation will
40+
* set the data to the delta value. If either of the delta value or the existing
41+
* data are doubles, both values will be interpreted as doubles. Double
42+
* arithmetic and representation of double values follow IEEE 754 semantics. If
43+
* there is positive/negative integer overflow, the sum is calculated as a a
44+
* double.
45+
*
46+
* @param delta the amount to modify the current value atomically.
47+
* @return a placeholder value for modifying data atomically server-side.
48+
*/
49+
+ (NSDictionary *)increment:(NSNumber *)delta NS_SWIFT_NAME(increment(_:));
50+
3451
@end
3552

3653
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)