Skip to content

Commit c17f6d9

Browse files
authored
feat(postgrest): rename foreignTable to referencedTable (#166)
1 parent 8373acb commit c17f6d9

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Sources/PostgREST/PostgrestTransformBuilder.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ public class PostgrestTransformBuilder: PostgrestBuilder {
2929
/// - column: The column to order on.
3030
/// - ascending: If `true`, the result will be in ascending order.
3131
/// - nullsFirst: If `true`, `null`s appear first.
32-
/// - foreignTable: The foreign table to use (if `column` is a foreign column).
32+
/// - referencedTable: The foreign table to use (if `column` is a foreign column).
3333
public func order(
3434
_ column: String,
3535
ascending: Bool = true,
3636
nullsFirst: Bool = false,
37-
foreignTable: String? = nil
37+
referencedTable: String? = nil
3838
) -> PostgrestTransformBuilder {
3939
mutableState.withValue {
40-
let key = foreignTable.map { "\($0).order" } ?? "order"
40+
let key = referencedTable.map { "\($0).order" } ?? "order"
4141
let existingOrderIndex = $0.request.query.firstIndex { $0.name == key }
4242
let value =
4343
"\(column).\(ascending ? "asc" : "desc").\(nullsFirst ? "nullsfirst" : "nullslast")"
@@ -60,10 +60,10 @@ public class PostgrestTransformBuilder: PostgrestBuilder {
6060
/// Limits the result with the specified `count`.
6161
/// - Parameters:
6262
/// - count: The maximum no. of rows to limit to.
63-
/// - foreignTable: The foreign table to use (for foreign columns).
64-
public func limit(_ count: Int, foreignTable: String? = nil) -> PostgrestTransformBuilder {
63+
/// - referencedTable: The foreign table to use (for foreign columns).
64+
public func limit(_ count: Int, referencedTable: String? = nil) -> PostgrestTransformBuilder {
6565
mutableState.withValue {
66-
let key = foreignTable.map { "\($0).limit" } ?? "limit"
66+
let key = referencedTable.map { "\($0).limit" } ?? "limit"
6767
if let index = $0.request.query.firstIndex(where: { $0.name == key }) {
6868
$0.request.query[index] = URLQueryItem(name: key, value: "\(count)")
6969
} else {
@@ -77,14 +77,14 @@ public class PostgrestTransformBuilder: PostgrestBuilder {
7777
/// - Parameters:
7878
/// - lowerBounds: The starting index from which to limit the result, inclusive.
7979
/// - upperBounds: The last index to which to limit the result, inclusive.
80-
/// - foreignTable: The foreign table to use (for foreign columns).
80+
/// - referencedTable: The foreign table to use (for foreign columns).
8181
public func range(
8282
from lowerBounds: Int,
8383
to upperBounds: Int,
84-
foreignTable: String? = nil
84+
referencedTable: String? = nil
8585
) -> PostgrestTransformBuilder {
86-
let keyOffset = foreignTable.map { "\($0).offset" } ?? "offset"
87-
let keyLimit = foreignTable.map { "\($0).limit" } ?? "limit"
86+
let keyOffset = referencedTable.map { "\($0).offset" } ?? "offset"
87+
let keyLimit = referencedTable.map { "\($0).limit" } ?? "limit"
8888

8989
mutableState.withValue {
9090
if let index = $0.request.query.firstIndex(where: { $0.name == keyOffset }) {

0 commit comments

Comments
 (0)