Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
f1b5b5d
[realppl 3] Arithmetic and comparison expressions
wu-hui Apr 14, 2025
6294868
[realppl 4] Array, debug, field and logical expressions
wu-hui Apr 16, 2025
6c0a698
[realppl 5] map,string,timestamp and mirroring semantics
wu-hui Apr 17, 2025
8efed9e
[realppl 6] offline ppl evaluation and tests
wu-hui Apr 24, 2025
0a8821c
[realppl 7] realppl integration with remote/local and unit tests
wu-hui Apr 30, 2025
f79f655
Remove Fuzzer
wu-hui May 27, 2025
8b8d4a2
[realppl 8] realppl spec tests
wu-hui May 13, 2025
0d65b86
[realppl 9] realppl public api and integration tests
wu-hui Apr 30, 2025
a1ad8f9
[realppl 10] Add server timestamp support
wu-hui Jun 16, 2025
3a10495
[realppl 11] Add query to pipeline support
wu-hui Jul 9, 2025
5a50bd6
Hide realtime pipelines
wu-hui Sep 12, 2025
a54bd45
address API feedbacks
cherylEnkidu Sep 21, 2025
e76d2a2
add documentation
cherylEnkidu Sep 21, 2025
fac2f83
rename Firestore/Swift/Source/ExprImpl.swift
cherylEnkidu Sep 21, 2025
2951a6c
expand expr to expression
cherylEnkidu Sep 25, 2025
afa920e
move files
cherylEnkidu Sep 25, 2025
d77d6d5
move files
cherylEnkidu Sep 25, 2025
18fbbae
move file
cherylEnkidu Sep 25, 2025
7c7eb75
Separate PipelineSource and RealtimePipelineSource
cherylEnkidu Sep 25, 2025
caf8158
add abs()
cherylEnkidu Sep 25, 2025
fb482c7
add arrayReverse
cherylEnkidu Sep 25, 2025
62434c1
add ceil()
cherylEnkidu Sep 25, 2025
d5d5c9d
add collectionId()
cherylEnkidu Sep 26, 2025
11bf771
add countDistinct()
cherylEnkidu Sep 26, 2025
00c6256
add exp()
cherylEnkidu Sep 29, 2025
814074f
make all bit operations internal
cherylEnkidu Sep 29, 2025
54461f1
add floor()
cherylEnkidu Sep 29, 2025
8e8557f
add length()
cherylEnkidu Sep 29, 2025
ead6684
hide manhattanDistance()
cherylEnkidu Sep 29, 2025
c720527
add ln()
cherylEnkidu Sep 30, 2025
69ced35
add pow()
cherylEnkidu Sep 30, 2025
3d0a3d3
hide replace expression
cherylEnkidu Sep 30, 2025
617feb4
rename substring
cherylEnkidu Sep 30, 2025
5bc46e3
add more expressions
cherylEnkidu Sep 30, 2025
452875f
make internal impl of Order public
cherylEnkidu Sep 30, 2025
3a258b2
rename timestampSubtract
cherylEnkidu Sep 30, 2025
1c00eea
refactor snapshot
cherylEnkidu Sep 30, 2025
aaa7855
move file
cherylEnkidu Sep 30, 2025
d02c044
remove backpointer to parent
cherylEnkidu Sep 30, 2025
fd8ed65
equivalent()
cherylEnkidu Sep 30, 2025
418e3a6
merge in base branch
cherylEnkidu Sep 30, 2025
e42cce2
merge in base 2
cherylEnkidu Sep 30, 2025
2fb7a14
add concat()
cherylEnkidu Oct 1, 2025
8422b15
add currentTimestamp()
cherylEnkidu Oct 1, 2025
45797e1
hide equivalent
cherylEnkidu Oct 1, 2025
b377edb
add ifAbsent and error
cherylEnkidu Oct 1, 2025
903425b
add join()
cherylEnkidu Oct 1, 2025
50b673e
rename logical
cherylEnkidu Oct 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
595 changes: 0 additions & 595 deletions Firestore/Swift/Source/ExprImpl.swift

This file was deleted.

915 changes: 915 additions & 0 deletions Firestore/Swift/Source/ExpressionImplementation.swift

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,19 @@
#endif // SWIFT_PACKAGE
import Foundation

@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
struct RealtimePipelineSnapshot: Sendable {
/// The Pipeline on which `execute()` was called to obtain this `PipelineSnapshot`.
public let pipeline: RealtimePipeline

/// An array of all the results in the `PipelineSnapshot`.
let results_cache: [PipelineResult]

public let changes: [PipelineResultChange]
public let metadata: SnapshotMetadata

let bridge: __RealtimePipelineSnapshotBridge

init(_ bridge: __RealtimePipelineSnapshotBridge, pipeline: RealtimePipeline) {
self.bridge = bridge
self.pipeline = pipeline
metadata = bridge.metadata
results_cache = self.bridge.results.map { PipelineResult($0) }
changes = self.bridge.changes.map { PipelineResultChange($0) }
}

public func results() -> [PipelineResult] {
return results_cache
}
}

@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
struct PipelineResultChange: Sendable {
public enum ChangeType {
case added, modified, removed
}

let bridge: __PipelineResultChangeBridge

Check failure on line 28 in Firestore/Swift/Source/PipelineResultChange.swift

View workflow job for this annotation

GitHub Actions / spm-binary / spm (macos-15, Xcode_16.4, iOS)

cannot find type '__PipelineResultChangeBridge' in scope

Check failure on line 28 in Firestore/Swift/Source/PipelineResultChange.swift

View workflow job for this annotation

GitHub Actions / spm-binary / spm (macos-14, Xcode_16.2, iOS)

cannot find type '__PipelineResultChangeBridge' in scope
public let result: PipelineResult

public let oldIndex: UInt?
public let newIndex: UInt?

init(_ bridge: __PipelineResultChangeBridge) {

Check failure on line 34 in Firestore/Swift/Source/PipelineResultChange.swift

View workflow job for this annotation

GitHub Actions / spm-binary / spm (macos-15, Xcode_16.4, iOS)

cannot find type '__PipelineResultChangeBridge' in scope

Check failure on line 34 in Firestore/Swift/Source/PipelineResultChange.swift

View workflow job for this annotation

GitHub Actions / spm-binary / spm (macos-14, Xcode_16.2, iOS)

cannot find type '__PipelineResultChangeBridge' in scope
self.bridge = bridge
result = PipelineResult(self.bridge.result)
oldIndex = self.bridge.oldIndex == NSNotFound ? nil : self.bridge.oldIndex
Expand Down
8 changes: 4 additions & 4 deletions Firestore/Swift/Source/SwiftAPI/Firestore+Pipeline.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ import Foundation

@objc public extension Firestore {
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
@nonobjc func pipeline() -> PipelineSource<Pipeline> {
return PipelineSource<Pipeline>(db: self) { stages, db in
@nonobjc func pipeline() -> PipelineSource {
return PipelineSource(db: self) { stages, db in
Pipeline(stages: stages, db: db)
}
}

@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
@nonobjc internal func realtimePipeline() -> PipelineSource<RealtimePipeline> {
return PipelineSource<RealtimePipeline>(db: self) { stages, db in
@nonobjc internal func realtimePipeline() -> RealtimePipelineSource {
return RealtimePipelineSource(db: self) { stages, db in
RealtimePipeline(stages: stages, db: db)
}
}
Expand Down
File renamed without changes.
61 changes: 51 additions & 10 deletions Firestore/Swift/Source/SwiftAPI/Pipeline/Expressions/Constant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,26 @@
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE

///
/// A `Constant` is an `Expression` that represents a fixed, literal value within a Firestore
/// pipeline.
///
/// `Constant`s are used to introduce literal values into a query, which can be useful for:
/// - Comparing a field to a specific value in a `where` clause.
/// - Adding new fields with fixed values using `addFields`.
/// - Providing literal arguments to functions like `sum` or `average`.
///
/// Example of using a `Constant` to add a new field:
/// ```swift
/// // Add a new field "source" with the value "manual" to each document
/// firestore.pipeline()
/// .collection("entries")
/// .addFields([
/// Constant("manual").as("source")
/// ])
/// ```
public struct Constant: Expression, BridgeWrapper, @unchecked Sendable {
let bridge: ExprBridge

Check failure on line 40 in Firestore/Swift/Source/SwiftAPI/Pipeline/Expressions/Constant.swift

View workflow job for this annotation

GitHub Actions / spm-binary / spm (macos-15, Xcode_16.4, iOS)

cannot find type 'ExprBridge' in scope

Check failure on line 40 in Firestore/Swift/Source/SwiftAPI/Pipeline/Expressions/Constant.swift

View workflow job for this annotation

GitHub Actions / spm-binary / spm (macos-14, Xcode_16.2, iOS)

cannot find type 'ExprBridge' in scope

let value: Any?

Expand All @@ -33,55 +51,78 @@
}
}

// Initializer for integer
/// Creates a new `Constant` expression from an integer literal.
///
/// - Parameter value: The integer value.
public init(_ value: Int) {
self.init(value as Any)
}

// Initializer for double
/// Creates a new `Constant` expression from a double-precision floating-point literal.
///
/// - Parameter value: The double value.
public init(_ value: Double) {
self.init(value as Any)
}

// Initializer for strings
/// Creates a new `Constant` expression from a string literal.
///
/// - Parameter value: The string value.
public init(_ value: String) {
self.init(value as Any)
}

// Initializer for boolean values
/// Creates a new `Constant` expression from a boolean literal.
///
/// - Parameter value: The boolean value.
public init(_ value: Bool) {
self.init(value as Any)
}

// Initializer for Bytes
/// Creates a new `Constant` expression from a `Data` (bytes) literal.
///
/// - Parameter value: The `Data` value.
public init(_ value: Data) {
self.init(value as Any)
}

// Initializer for GeoPoint values
/// Creates a new `Constant` expression from a `GeoPoint` literal.
///
/// - Parameter value: The `GeoPoint` value.
public init(_ value: GeoPoint) {
self.init(value as Any)
}

// Initializer for Timestamp values
/// Creates a new `Constant` expression from a `Timestamp` literal.
///
/// - Parameter value: The `Timestamp` value.
public init(_ value: Timestamp) {
self.init(value as Any)
}

// Initializer for Date values
/// Creates a new `Constant` expression from a `Date` literal.
///
/// The `Date` will be converted to a `Timestamp` internally.
///
/// - Parameter value: The `Date` value.
public init(_ value: Date) {
self.init(value as Any)
}

// Initializer for DocumentReference
/// Creates a new `Constant` expression from a `DocumentReference` literal.
///
/// - Parameter value: The `DocumentReference` value.
public init(_ value: DocumentReference) {
self.init(value as Any)
}

// Initializer for vector values
/// Creates a new `Constant` expression from a `VectorValue` literal.
///
/// - Parameter value: The `VectorValue` value.
public init(_ value: VectorValue) {
self.init(value as Any)
}

/// A `Constant` representing a `nil` value.
public static let `nil` = Constant(nil)
}

This file was deleted.

Loading
Loading