FIRServerValue.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. NS_ASSUME_NONNULL_BEGIN
  18. /**
  19. * Placeholder values you may write into Firebase Database as a value or
  20. * priority that will automatically be populated by the Firebase Database
  21. * server.
  22. */
  23. NS_SWIFT_NAME(ServerValue)
  24. @interface FIRServerValue : NSObject
  25. /**
  26. * Placeholder value for the number of milliseconds since the Unix epoch
  27. */
  28. + (NSDictionary *)timestamp;
  29. /**
  30. * Returns a placeholder value that can be used to atomically increment the
  31. * current database value by the provided delta.
  32. *
  33. * The delta must be a long or double value. If the current value is not an
  34. * integer or double, or if the data does not yet exist, the transformation will
  35. * set the data to the delta value. If either of the delta value or the existing
  36. * data are doubles, both values will be interpreted as doubles. Double
  37. * arithmetic and representation of double values follow IEEE 754 semantics. If
  38. * there is positive/negative integer overflow, the sum is calculated as a
  39. * double.
  40. *
  41. * @param delta the amount to modify the current value atomically.
  42. * @return a placeholder value for modifying data atomically server-side.
  43. */
  44. + (NSDictionary *)increment:(NSNumber *)delta NS_SWIFT_NAME(increment(_:));
  45. @end
  46. NS_ASSUME_NONNULL_END