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 7 commits 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
18 changes: 10 additions & 8 deletions Firestore/Example/Firestore.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

514 changes: 250 additions & 264 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 @@ -22,5 +22,5 @@ protocol AggregateBridgeWrapper {

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 @@ -22,9 +22,9 @@ public class AggregateFunction: AggregateBridgeWrapper, @unchecked Sendable {
let bridge: AggregateFunctionBridge

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 class AggregateFunction: AggregateBridgeWrapper, @unchecked Sendable {
)
}

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
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 class ArrayContains: BooleanExpr, @unchecked Sendable {
public class ArrayContains: BooleanExpression, @unchecked Sendable {
public init(fieldName: String, values: Sendable...) {
super.init("array_contains", values.map { Helper.sendableToExpr($0) })
}
Expand Down
19 changes: 0 additions & 19 deletions Firestore/Swift/Source/SwiftAPI/Pipeline/Ascending.swift

This file was deleted.

19 changes: 0 additions & 19 deletions Firestore/Swift/Source/SwiftAPI/Pipeline/Descending.swift

This file was deleted.

Loading
Loading