-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
125 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,16 +89,16 @@ | |
.upsert(values: ["email": "[email protected]"], ignoreDuplicates: true) | ||
}, | ||
TestCase(name: "query with + character") { client in | ||
client.from("users") | ||
await client.from("users") | ||
.select() | ||
.eq(column: "id", value: "Cigányka-ér (0+400 cskm) vízrajzi állomás") | ||
}, | ||
TestCase(name: "query with timestampz") { client in | ||
client.from("tasks") | ||
await client.from("tasks") | ||
.select() | ||
.gt(column: "received_at", value: "2023-03-23T15:50:30.511743+00:00") | ||
.order(column: "received_at") | ||
} | ||
}, | ||
] | ||
|
||
for testCase in testCases { | ||
|
@@ -115,35 +115,4 @@ | |
} | ||
} | ||
|
||
final class LockIsolated<Value>: @unchecked Sendable { | ||
private let lock = NSRecursiveLock() | ||
private var _value: Value | ||
|
||
init(_ value: Value) { | ||
self._value = value | ||
} | ||
|
||
@discardableResult | ||
func withValue<T>(_ block: (inout Value) throws -> T) rethrows -> T { | ||
try lock.sync { | ||
var value = self._value | ||
defer { self._value = value } | ||
return try block(&value) | ||
} | ||
} | ||
|
||
var value: Value { | ||
lock.sync { self._value } | ||
} | ||
} | ||
|
||
extension NSRecursiveLock { | ||
@discardableResult | ||
func sync<R>(work: () throws -> R) rethrows -> R { | ||
lock() | ||
defer { unlock() } | ||
return try work() | ||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Guilherme Souza on 07/10/23. | ||
// | ||
|
||
import Foundation | ||
|
||
final class LockIsolated<Value>: @unchecked Sendable { | ||
private let lock = NSRecursiveLock() | ||
private var _value: Value | ||
|
||
init(_ value: Value) { | ||
self._value = value | ||
} | ||
|
||
@discardableResult | ||
func withValue<T>(_ block: (inout Value) throws -> T) rethrows -> T { | ||
try lock.sync { | ||
var value = self._value | ||
defer { self._value = value } | ||
return try block(&value) | ||
} | ||
} | ||
|
||
var value: Value { | ||
lock.sync { self._value } | ||
} | ||
} | ||
|
||
extension NSRecursiveLock { | ||
@discardableResult | ||
func sync<R>(work: () throws -> R) rethrows -> R { | ||
lock() | ||
defer { unlock() } | ||
return try work() | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
...TTests/__Snapshots__/BuildURLRequestTests/testBuildRequest.call-rpc-without-parameter.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
curl \ | ||
--request POST \ | ||
--header "Accept: application/json" \ | ||
--header "Content-Type: application/json" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.1" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.2" \ | ||
"https://example.supabase.co/rpc/test_fcn" |
3 changes: 2 additions & 1 deletion
3
Tests/PostgRESTTests/__Snapshots__/BuildURLRequestTests/testBuildRequest.call-rpc.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
curl \ | ||
--request POST \ | ||
--header "Accept: application/json" \ | ||
--header "Content-Type: application/json" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.1" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.2" \ | ||
--data "{\"KEY\":\"VALUE\"}" \ | ||
"https://example.supabase.co/rpc/test_fcn" |
3 changes: 2 additions & 1 deletion
3
Tests/PostgRESTTests/__Snapshots__/BuildURLRequestTests/testBuildRequest.insert-new-user.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
curl \ | ||
--request POST \ | ||
--header "Accept: application/json" \ | ||
--header "Content-Type: application/json" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.1" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.2" \ | ||
--data "{\"email\":\"[email protected]\"}" \ | ||
"https://example.supabase.co/users" |
1 change: 1 addition & 0 deletions
1
...stgRESTTests/__Snapshots__/BuildURLRequestTests/testBuildRequest.query-with-character.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
curl \ | ||
--header "Accept: application/json" \ | ||
--header "Content-Type: application/json" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.2" \ | ||
"https://example.supabase.co/users?id=eq.Cig%C3%A1nyka-%C3%A9r%20(0+400%20cskm)%20v%C3%ADzrajzi%20%C3%A1llom%C3%A1s&select=*" |
1 change: 1 addition & 0 deletions
1
...tgRESTTests/__Snapshots__/BuildURLRequestTests/testBuildRequest.query-with-timestampz.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
curl \ | ||
--header "Accept: application/json" \ | ||
--header "Content-Type: application/json" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.2" \ | ||
"https://example.supabase.co/tasks?order=received_at.asc.nullslast&received_at=gt.2023-03-23T15:50:30.511743+00:00&select=*" |
3 changes: 2 additions & 1 deletion
3
...ldURLRequestTests/testBuildRequest.select-all-users-where-email-ends-with-supabase-co.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
curl \ | ||
--header "Accept: application/json" \ | ||
--header "Content-Type: application/json" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.1" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.2" \ | ||
"https://example.supabase.co/users?email=like.%[email protected]&select=*" |
3 changes: 2 additions & 1 deletion
3
...TTests/__Snapshots__/BuildURLRequestTests/testBuildRequest.test-all-filters-and-count.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
curl \ | ||
--header "Accept: application/json" \ | ||
--header "Content-Type: application/json" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.1" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.2" \ | ||
"https://example.supabase.co/todos?column=eq.Some%20value&column=neq.Some%20value&column=gt.Some%20value&column=gte.Some%20value&column=lt.Some%20value&column=lte.Some%20value&column=like.Some%20value&column=ilike.Some%20value&column=is.Some%20value&column=in.Some%20value&column=cs.Some%20value&column=cd.Some%20value&column=sl.Some%20value&column=sr.Some%20value&column=nxl.Some%20value&column=nxr.Some%20value&column=adj.Some%20value&column=ov.Some%20value&column=fts.Some%20value&column=plfts.Some%20value&column=phfts.Some%20value&column=wfts.Some%20value&select=*" |
3 changes: 2 additions & 1 deletion
3
...s/__Snapshots__/BuildURLRequestTests/testBuildRequest.test-contains-filter-with-array.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
curl \ | ||
--header "Accept: application/json" \ | ||
--header "Content-Type: application/json" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.1" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.2" \ | ||
"https://example.supabase.co/users?name=cs.%7Bis:online,faction:red%7D&select=*" |
3 changes: 2 additions & 1 deletion
3
...napshots__/BuildURLRequestTests/testBuildRequest.test-contains-filter-with-dictionary.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
curl \ | ||
--header "Accept: application/json" \ | ||
--header "Content-Type: application/json" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.1" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.2" \ | ||
"https://example.supabase.co/users?address=cs.%7B%22postcode%22:90210%7D&select=name" |
3 changes: 2 additions & 1 deletion
3
Tests/PostgRESTTests/__Snapshots__/BuildURLRequestTests/testBuildRequest.test-in-filter.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
curl \ | ||
--header "Accept: application/json" \ | ||
--header "Content-Type: application/json" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.1" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.2" \ | ||
"https://example.supabase.co/todos?id=in.(1,2,3)&select=*" |
3 changes: 2 additions & 1 deletion
3
...s/__Snapshots__/BuildURLRequestTests/testBuildRequest.test-upsert-ignoring-duplicates.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
curl \ | ||
--request POST \ | ||
--header "Accept: application/json" \ | ||
--header "Content-Type: application/json" \ | ||
--header "Prefer: resolution=ignore-duplicates,return=representation" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.1" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.2" \ | ||
--data "{\"email\":\"[email protected]\"}" \ | ||
"https://example.supabase.co/users" |
3 changes: 2 additions & 1 deletion
3
...Snapshots__/BuildURLRequestTests/testBuildRequest.test-upsert-not-ignoring-duplicates.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
curl \ | ||
--request POST \ | ||
--header "Accept: application/json" \ | ||
--header "Content-Type: application/json" \ | ||
--header "Prefer: resolution=merge-duplicates,return=representation" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.1" \ | ||
--header "X-Client-Info: postgrest-swift/1.0.2" \ | ||
--data "{\"email\":\"[email protected]\"}" \ | ||
"https://example.supabase.co/users" |