Skip to content

Ppl public API changes #15066

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: cheryllin/ppl
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
358 changes: 179 additions & 179 deletions Firestore/Swift/Source/ExprImpl.swift

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions Firestore/Swift/Source/Helper/PipelineHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
// limitations under the License.

enum Helper {
static func sendableToExpr(_ value: Sendable?) -> Expr {
static func sendableToExpr(_ value: Sendable?) -> Expression {
guard let value = value else {
return Constant.nil
}

if let exprValue = value as? Expr {
if let exprValue = value as? Expression {
return exprValue
} else if let dictionaryValue = value as? [String: Sendable?] {
return map(dictionaryValue)
Expand All @@ -31,8 +31,8 @@ enum Helper {
}
}

static func selectablesToMap(selectables: [Selectable]) -> [String: Expr] {
let exprMap = selectables.reduce(into: [String: Expr]()) { result, selectable in
static func selectablesToMap(selectables: [Selectable]) -> [String: Expression] {
let exprMap = selectables.reduce(into: [String: Expression]()) { result, selectable in
guard let value = selectable as? SelectableWrapper else {
fatalError("Selectable class must conform to SelectableWrapper.")
}
Expand All @@ -41,20 +41,20 @@ enum Helper {
return exprMap
}

static func map(_ elements: [String: Sendable?]) -> FunctionExpr {
var result: [Expr] = []
static func map(_ elements: [String: Sendable?]) -> FunctionExpression {
var result: [Expression] = []
for (key, value) in elements {
result.append(Constant(key))
result.append(sendableToExpr(value))
}
return FunctionExpr("map", result)
return FunctionExpression("map", result)
}

static func array(_ elements: [Sendable?]) -> FunctionExpr {
static func array(_ elements: [Sendable?]) -> FunctionExpression {
let transformedElements = elements.map { element in
sendableToExpr(element)
}
return FunctionExpr("array", transformedElements)
return FunctionExpression("array", transformedElements)
}

// This function is used to convert Swift type into Objective-C type.
Expand All @@ -63,7 +63,7 @@ enum Helper {
return Constant.nil.bridge
}

if let exprValue = value as? Expr {
if let exprValue = value as? Expression {
return exprValue.toBridge()
} else if let aggregateFunctionValue = value as? AggregateFunction {
return aggregateFunctionValue.toBridge()
Expand Down
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/PipelineWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
// limitations under the License.

protocol BridgeWrapper {
var bridge: ExprBridge { get }

Check failure on line 16 in Firestore/Swift/Source/PipelineWrapper.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 16 in Firestore/Swift/Source/PipelineWrapper.swift

View workflow job for this annotation

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

cannot find type 'ExprBridge' in scope
}

protocol AggregateBridgeWrapper {
var bridge: AggregateFunctionBridge { get }

Check failure on line 20 in Firestore/Swift/Source/PipelineWrapper.swift

View workflow job for this annotation

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

cannot find type 'AggregateFunctionBridge' in scope

Check failure on line 20 in Firestore/Swift/Source/PipelineWrapper.swift

View workflow job for this annotation

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

cannot find type 'AggregateFunctionBridge' in scope
}

protocol SelectableWrapper: Sendable {
var alias: String { get }
var expr: Expr { get }
var expr: Expression { get }
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
// limitations under the License.

extension AggregateFunction {
func toBridge() -> AggregateFunctionBridge {

Check failure on line 16 in Firestore/Swift/Source/SwiftAPI/Pipeline/Aggregation/AggregateFunction.swift

View workflow job for this annotation

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

cannot find type 'AggregateFunctionBridge' in scope

Check failure on line 16 in Firestore/Swift/Source/SwiftAPI/Pipeline/Aggregation/AggregateFunction.swift

View workflow job for this annotation

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

cannot find type 'AggregateFunctionBridge' in scope
return (self as AggregateBridgeWrapper).bridge
}
}

public class AggregateFunction: AggregateBridgeWrapper, @unchecked Sendable {
let bridge: AggregateFunctionBridge

Check failure on line 22 in Firestore/Swift/Source/SwiftAPI/Pipeline/Aggregation/AggregateFunction.swift

View workflow job for this annotation

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

cannot find type 'AggregateFunctionBridge' in scope

Check failure on line 22 in Firestore/Swift/Source/SwiftAPI/Pipeline/Aggregation/AggregateFunction.swift

View workflow job for this annotation

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

cannot find type 'AggregateFunctionBridge' in scope

let functionName: String
let args: [Expr]
let args: [Expression]

public init(_ functionName: String, _ args: [Expr]) {
public init(_ functionName: String, _ args: [Expression]) {
self.functionName = functionName
self.args = args
bridge = AggregateFunctionBridge(
Expand All @@ -34,7 +34,7 @@
)
}

public func `as`(_ name: String) -> AggregateWithAlias {
return AggregateWithAlias(aggregate: self, alias: name)
public func `as`(_ name: String) -> AliasedAggregate {
return AliasedAggregate(aggregate: self, alias: name)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

public struct AggregateWithAlias {
public struct AliasedAggregate {
public let aggregate: AggregateFunction
public let alias: String
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

public struct ExprWithAlias: Selectable, SelectableWrapper, Sendable {
public struct AliasedExpression: Selectable, SelectableWrapper, Sendable {
public var alias: String

public var expr: Expr
public var expr: Expression

init(_ expr: Expr, _ alias: String) {
init(_ expr: Expression, _ alias: String) {
self.alias = alias
self.expr = expr
}
Expand Down
Loading
Loading