Skip to content

Commit 6376107

Browse files
authored
feat(postgrest): set coder in SupabaseClientOptions (#185)
1 parent 5124a58 commit 6376107

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Sources/Supabase/SupabaseClient.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ public final class SupabaseClient: @unchecked Sendable {
2727
url: databaseURL,
2828
schema: options.db.schema,
2929
headers: defaultHeaders,
30-
fetch: fetchWithAuth
30+
fetch: fetchWithAuth,
31+
encoder: options.db.encoder,
32+
decoder: options.db.decoder
3133
)
3234

3335
/// Supabase Storage allows you to manage user-generated content, such as photos or videos.

Sources/Supabase/Types.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ public struct SupabaseClientOptions: Sendable {
1010
/// The Postgres schema which your tables belong to. Must be on the list of exposed schemas in
1111
/// Supabase. Defaults to `public`.
1212
public let schema: String
13+
public let encoder: JSONEncoder
14+
public let decoder: JSONDecoder
1315

14-
public init(schema: String = "public") {
16+
public init(schema: String = "public", encoder: JSONEncoder = .postgrest, decoder: JSONDecoder = .postgrest) {
1517
self.schema = schema
18+
self.encoder = encoder
19+
self.decoder = decoder
1620
}
1721
}
1822

0 commit comments

Comments
 (0)